Re: Toggle Shading of Table Cell on and off Upon Mouse Click
From: Cris (anonymous_at_discussions.microsoft.com)
Date: 09/07/04
- Next message: Thomas Dawe: "Template to feed Properties"
- Previous message: Charles Kenyon: "FAQ - Frequently Asked Questions - vba - please read before posting - unofficial September posting"
- In reply to: Jay Freedman: "Re: Toggle Shading of Table Cell on and off Upon Mouse Click"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 7 Sep 2004 09:21:09 -0700
Jay:
Thanks very much for the suggested fix. I'm learning a
great deal from all the MVPs - and sure appreciate your
help.
Cris
>-----Original Message-----
>Hi Cris,
>
>Would it be ok to require a double-click? If so, read
on...
>
>Set up an add-in according to the instructions at
>http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm.
When you get
>to step 6, use this event handler in the ThisApplication
class module:
>
>Public WithEvents oApp As Word.Application
>
>Private Sub oApp_WindowBeforeDoubleClick( _
> ByVal Sel As Selection, Cancel As Boolean)
> If Sel.Information(wdWithInTable) Then
> With Sel.Cells(1).Shading
> If .BackgroundPatternColor = wdColorAutomatic Then
> .BackgroundPatternColor = wdColorRed
> Else
> .BackgroundPatternColor = wdColorAutomatic
> End If
> End With
> End If
>End Sub
>
>If necessary, you can add a test at the beginning so that
the rest of
>the code runs only if the active document is based on a
particular
>template (your form).
>
>--
>Regards,
>Jay Freedman http://aspnet2.com/mvp.ashx?
JayFreedman
>Microsoft Word MVP FAQ: http://word.mvps.org
>
>"Cris" <anonymous@discussions.microsoft.com> wrote:
>
>>I browsed through the forum and didn't see my particular
>>question answered, so I hope I'm not duplicating an
>>earlier entry.
>>
>>I have a form that contains a table. If a user clicks
on
>>a particular cell once, I want that cell to switch to
red
>>shading. If the user clicks on that same cell again, I
>>want the cell to revert back to white shading. My
client
>>does not wish to see anything inside the table cell
(e.g.,
>>any visible button such as the toggle button).
>>
>>How do I accomplish this? I'm brand new to macros and
>>Visual Basic. I'm coming up on a deadline, so I'd
>>appreciate any help available.
>>
>>Thanks for any pointers you can provide.
>
>.
>
- Next message: Thomas Dawe: "Template to feed Properties"
- Previous message: Charles Kenyon: "FAQ - Frequently Asked Questions - vba - please read before posting - unofficial September posting"
- In reply to: Jay Freedman: "Re: Toggle Shading of Table Cell on and off Upon Mouse Click"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|