Re: Toggle Shading of Table Cell on and off Upon Mouse Click

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Cris (anonymous_at_discussions.microsoft.com)
Date: 09/07/04


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.
>
>.
>



Relevant Pages

  • OLTL Carlo the Greek Chorus
    ... Why on earth would Carlo care one whit about Cris? ... Every time I see Carlo overacting his way into Cris' cell, ...
    (rec.arts.tv.soaps.abc)
  • Re: Code error!
    ... Maybe you could start a new topic about loss of cell merging and ... hopefully one of the MVPs can sort it out. ... here is a case of Center Across Selection formatting also being lost so ... copy/paste to copy then paste special/ paste formats. ...
    (microsoft.public.excel.programming)
  • Re: Toggle Shading of Table Cell on and off Upon Mouse Click
    ... >How does someone with no VBA experience get clients? ... >without SOMETHING appearing in the cell. ... >check if the selection is within a table and only allow ... >> want the cell to revert back to white shading. ...
    (microsoft.public.word.vba.userforms)
  • Re: Toggle Shading of Table Cell on and off Upon Mouse Click
    ... Set up an add-in according to the instructions at ... Private Sub oApp_WindowBeforeDoubleClick(_ ... >a particular cell once, I want that cell to switch to red ... >want the cell to revert back to white shading. ...
    (microsoft.public.word.vba.userforms)
  • Re: Toggle Shading of Table Cell on and off Upon Mouse Click
    ... How does someone with no VBA experience get clients? ... there is no way that you can make it run by clicking in the cell ... it could work on any cell in which the selection was ... > want the cell to revert back to white shading. ...
    (microsoft.public.word.vba.userforms)