I have created a template form in Word 2002 (XP). In my form there is a
table. One of the table's columns contains a checkbox in each row. What I
would like to have happen is that when the user checks the checkbox the row
that it is in will become highlighted/shaded. I am assuming that I will need
to do this with a macro, but I am not sure. If there is an easier way that
would be great! I am a macro novice so any assistance would be greatly
appreciated.

Re: Word Forms and Macros Question by Doug

Doug
Wed Jun 22 13:50:55 CDT 2005

Run the following macro on exit from each of the checkboxes:

Dim ffname As String
ffname = Selection.FormFields(1).Name
With ActiveDocument
.Unprotect
If .FormFields(ffname).CheckBox.Value = True Then
.Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
wdColorAqua
Else
.Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
wdColorAutomatic
End If
.Protect wdAllowOnlyFormFields, noreset
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
"shanbones" <shanbones@discussions.microsoft.com> wrote in message
news:799D2C4E-8913-4303-BE06-550438F0A186@microsoft.com...
>I have created a template form in Word 2002 (XP). In my form there is a
> table. One of the table's columns contains a checkbox in each row. What I
> would like to have happen is that when the user checks the checkbox the
> row
> that it is in will become highlighted/shaded. I am assuming that I will
> need
> to do this with a macro, but I am not sure. If there is an easier way that
> would be great! I am a macro novice so any assistance would be greatly
> appreciated.



Re: Word Forms and Macros Question by shanbones

shanbones
Wed Jun 22 14:31:01 CDT 2005

Thank you for the info Doug. However, when I tried to run this macro Visual
Basic comes up with a "Compile Error: Syntax Error" message window and
hightlights the following portion of the macro:

.Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =

Any suggestions?
Thanks, Shannon

"Doug Robbins" wrote:

> Run the following macro on exit from each of the checkboxes:
>
> Dim ffname As String
> ffname = Selection.FormFields(1).Name
> With ActiveDocument
> .Unprotect
> If .FormFields(ffname).CheckBox.Value = True Then
> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
> wdColorAqua
> Else
> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
> wdColorAutomatic
> End If
> .Protect wdAllowOnlyFormFields, noreset
> End With
>
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
> "shanbones" <shanbones@discussions.microsoft.com> wrote in message
> news:799D2C4E-8913-4303-BE06-550438F0A186@microsoft.com...
> >I have created a template form in Word 2002 (XP). In my form there is a
> > table. One of the table's columns contains a checkbox in each row. What I
> > would like to have happen is that when the user checks the checkbox the
> > row
> > that it is in will become highlighted/shaded. I am assuming that I will
> > need
> > to do this with a macro, but I am not sure. If there is an easier way that
> > would be great! I am a macro novice so any assistance would be greatly
> > appreciated.
>
>
>

Re: Word Forms and Macros Question by Charles

Charles
Wed Jun 22 14:39:23 CDT 2005

A line got wrapped. The following line should be a part of this line. Look
for any others that end in = as well.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"shanbones" <shanbones@discussions.microsoft.com> wrote in message
news:BF010EFE-0497-4EB8-954F-25C2EE4D7B3B@microsoft.com...
> Thank you for the info Doug. However, when I tried to run this macro
> Visual
> Basic comes up with a "Compile Error: Syntax Error" message window and
> hightlights the following portion of the macro:
>
> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
>
> Any suggestions?
> Thanks, Shannon
>
> "Doug Robbins" wrote:
>
>> Run the following macro on exit from each of the checkboxes:
>>
>> Dim ffname As String
>> ffname = Selection.FormFields(1).Name
>> With ActiveDocument
>> .Unprotect
>> If .FormFields(ffname).CheckBox.Value = True Then
>> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
>> wdColorAqua
>> Else
>> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
>> wdColorAutomatic
>> End If
>> .Protect wdAllowOnlyFormFields, noreset
>> End With
>>
>>
>> --
>> Hope this helps.
>>
>> Please reply to the newsgroup unless you wish to avail yourself of my
>> services on a paid consulting basis.
>>
>> Doug Robbins - Word MVP
>> "shanbones" <shanbones@discussions.microsoft.com> wrote in message
>> news:799D2C4E-8913-4303-BE06-550438F0A186@microsoft.com...
>> >I have created a template form in Word 2002 (XP). In my form there is a
>> > table. One of the table's columns contains a checkbox in each row. What
>> > I
>> > would like to have happen is that when the user checks the checkbox the
>> > row
>> > that it is in will become highlighted/shaded. I am assuming that I will
>> > need
>> > to do this with a macro, but I am not sure. If there is an easier way
>> > that
>> > would be great! I am a macro novice so any assistance would be greatly
>> > appreciated.
>>
>>
>>



Re: Word Forms and Macros Question by shanbones

shanbones
Wed Jun 22 14:55:04 CDT 2005

I have followed the instructions listed below and am now receiving a "Compile
Error: Invalid use of property" highlighting the following section -
.BackgroundPatternColor

The entire macro is currently as follows:

Sub Highlightwhenchecked()
'
' Highlightwhenchecked Macro
' Macro created 6/22/2005 by Shannon Cook
'
Dim ffname As String
ffname = Selection.FormFields(1).Name
With ActiveDocument
.Unprotect
If .FormFields(ffname).CheckBox.Value = True Then
.Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor
wdColorAqua
Else
.Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor
wdColorAutomatic
End If
.Protect wdAllowOnlyFormFields, noreset
End With

End Sub

"Charles Kenyon" wrote:

> A line got wrapped. The following line should be a part of this line. Look
> for any others that end in = as well.
> --
> Charles Kenyon
>
> Word New User FAQ & Web Directory: http://addbalance.com/word
>
> Intermediate User's Guide to Microsoft Word (supplemented version of
> Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
>
> See also the MVP FAQ: http://www.mvps.org/word which is awesome!
> --------- --------- --------- --------- --------- ---------
> This message is posted to a newsgroup. Please post replies
> and questions to the newsgroup so that others can learn
> from my ignorance and your wisdom.
>
> "shanbones" <shanbones@discussions.microsoft.com> wrote in message
> news:BF010EFE-0497-4EB8-954F-25C2EE4D7B3B@microsoft.com...
> > Thank you for the info Doug. However, when I tried to run this macro
> > Visual
> > Basic comes up with a "Compile Error: Syntax Error" message window and
> > hightlights the following portion of the macro:
> >
> > .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
> >
> > Any suggestions?
> > Thanks, Shannon
> >
> > "Doug Robbins" wrote:
> >
> >> Run the following macro on exit from each of the checkboxes:
> >>
> >> Dim ffname As String
> >> ffname = Selection.FormFields(1).Name
> >> With ActiveDocument
> >> .Unprotect
> >> If .FormFields(ffname).CheckBox.Value = True Then
> >> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
> >> wdColorAqua
> >> Else
> >> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
> >> wdColorAutomatic
> >> End If
> >> .Protect wdAllowOnlyFormFields, noreset
> >> End With
> >>
> >>
> >> --
> >> Hope this helps.
> >>
> >> Please reply to the newsgroup unless you wish to avail yourself of my
> >> services on a paid consulting basis.
> >>
> >> Doug Robbins - Word MVP
> >> "shanbones" <shanbones@discussions.microsoft.com> wrote in message
> >> news:799D2C4E-8913-4303-BE06-550438F0A186@microsoft.com...
> >> >I have created a template form in Word 2002 (XP). In my form there is a
> >> > table. One of the table's columns contains a checkbox in each row. What
> >> > I
> >> > would like to have happen is that when the user checks the checkbox the
> >> > row
> >> > that it is in will become highlighted/shaded. I am assuming that I will
> >> > need
> >> > to do this with a macro, but I am not sure. If there is an easier way
> >> > that
> >> > would be great! I am a macro novice so any assistance would be greatly
> >> > appreciated.
> >>
> >>
> >>
>
>
>

Re: Word Forms and Macros Question by Charles

Charles
Wed Jun 22 15:06:42 CDT 2005

Deleting the = isn't the way. You need to continue the line. Something like
the following, which I have _not_ tried.

Dim ffname As String
ffname = Selection.FormFields(1).Name
With ActiveDocument
.Unprotect
If .FormFields(ffname).CheckBox.Value = True Then
.Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor _
= wdColorAqua
Else
.Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor _
= wdColorAutomatic
End If
.Protect wdAllowOnlyFormFields, noreset
End With

"shanbones" <shanbones@discussions.microsoft.com> wrote in message
news:C40331CC-C5A8-41BA-BC42-0EDA56AE1EA0@microsoft.com...
>I have followed the instructions listed below and am now receiving a
>"Compile
> Error: Invalid use of property" highlighting the following section -
> .BackgroundPatternColor
>
> The entire macro is currently as follows:
>
> Sub Highlightwhenchecked()
> '
> ' Highlightwhenchecked Macro
> ' Macro created 6/22/2005 by Shannon Cook
> '
> Dim ffname As String
> ffname = Selection.FormFields(1).Name
> With ActiveDocument
> .Unprotect
> If .FormFields(ffname).CheckBox.Value = True Then
> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor
> wdColorAqua
> Else
> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor
> wdColorAutomatic
> End If
> .Protect wdAllowOnlyFormFields, noreset
> End With
>
> End Sub
>
> "Charles Kenyon" wrote:
>
>> A line got wrapped. The following line should be a part of this line.
>> Look
>> for any others that end in = as well.
>> --
>> Charles Kenyon
>>
>> Word New User FAQ & Web Directory: http://addbalance.com/word
>>
>> Intermediate User's Guide to Microsoft Word (supplemented version of
>> Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
>>
>> See also the MVP FAQ: http://www.mvps.org/word which is awesome!
>> --------- --------- --------- --------- --------- ---------
>> This message is posted to a newsgroup. Please post replies
>> and questions to the newsgroup so that others can learn
>> from my ignorance and your wisdom.
>>
>> "shanbones" <shanbones@discussions.microsoft.com> wrote in message
>> news:BF010EFE-0497-4EB8-954F-25C2EE4D7B3B@microsoft.com...
>> > Thank you for the info Doug. However, when I tried to run this macro
>> > Visual
>> > Basic comes up with a "Compile Error: Syntax Error" message window and
>> > hightlights the following portion of the macro:
>> >
>> > .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor
>> > =
>> >
>> > Any suggestions?
>> > Thanks, Shannon
>> >
>> > "Doug Robbins" wrote:
>> >
>> >> Run the following macro on exit from each of the checkboxes:
>> >>
>> >> Dim ffname As String
>> >> ffname = Selection.FormFields(1).Name
>> >> With ActiveDocument
>> >> .Unprotect
>> >> If .FormFields(ffname).CheckBox.Value = True Then
>> >>
>> >> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
>> >> wdColorAqua
>> >> Else
>> >>
>> >> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
>> >> wdColorAutomatic
>> >> End If
>> >> .Protect wdAllowOnlyFormFields, noreset
>> >> End With
>> >>
>> >>
>> >> --
>> >> Hope this helps.
>> >>
>> >> Please reply to the newsgroup unless you wish to avail yourself of my
>> >> services on a paid consulting basis.
>> >>
>> >> Doug Robbins - Word MVP
>> >> "shanbones" <shanbones@discussions.microsoft.com> wrote in message
>> >> news:799D2C4E-8913-4303-BE06-550438F0A186@microsoft.com...
>> >> >I have created a template form in Word 2002 (XP). In my form there is
>> >> >a
>> >> > table. One of the table's columns contains a checkbox in each row.
>> >> > What
>> >> > I
>> >> > would like to have happen is that when the user checks the checkbox
>> >> > the
>> >> > row
>> >> > that it is in will become highlighted/shaded. I am assuming that I
>> >> > will
>> >> > need
>> >> > to do this with a macro, but I am not sure. If there is an easier
>> >> > way
>> >> > that
>> >> > would be great! I am a macro novice so any assistance would be
>> >> > greatly
>> >> > appreciated.
>> >>
>> >>
>> >>
>>
>>
>>



Re: Word Forms and Macros Question by shanbones

shanbones
Wed Jun 22 15:33:27 CDT 2005

PERFECT!

Thank you so very much for your help!

"Charles Kenyon" wrote:

> Deleting the = isn't the way. You need to continue the line. Something like
> the following, which I have _not_ tried.
>
> Dim ffname As String
> ffname = Selection.FormFields(1).Name
> With ActiveDocument
> .Unprotect
> If .FormFields(ffname).CheckBox.Value = True Then
> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor _
> = wdColorAqua
> Else
> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor _
> = wdColorAutomatic
> End If
> .Protect wdAllowOnlyFormFields, noreset
> End With
>
> "shanbones" <shanbones@discussions.microsoft.com> wrote in message
> news:C40331CC-C5A8-41BA-BC42-0EDA56AE1EA0@microsoft.com...
> >I have followed the instructions listed below and am now receiving a
> >"Compile
> > Error: Invalid use of property" highlighting the following section -
> > .BackgroundPatternColor
> >
> > The entire macro is currently as follows:
> >
> > Sub Highlightwhenchecked()
> > '
> > ' Highlightwhenchecked Macro
> > ' Macro created 6/22/2005 by Shannon Cook
> > '
> > Dim ffname As String
> > ffname = Selection.FormFields(1).Name
> > With ActiveDocument
> > .Unprotect
> > If .FormFields(ffname).CheckBox.Value = True Then
> > .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor
> > wdColorAqua
> > Else
> > .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor
> > wdColorAutomatic
> > End If
> > .Protect wdAllowOnlyFormFields, noreset
> > End With
> >
> > End Sub
> >
> > "Charles Kenyon" wrote:
> >
> >> A line got wrapped. The following line should be a part of this line.
> >> Look
> >> for any others that end in = as well.
> >> --
> >> Charles Kenyon
> >>
> >> Word New User FAQ & Web Directory: http://addbalance.com/word
> >>
> >> Intermediate User's Guide to Microsoft Word (supplemented version of
> >> Microsoft's Legal Users' Guide) http://addbalance.com/usersguide
> >>
> >> See also the MVP FAQ: http://www.mvps.org/word which is awesome!
> >> --------- --------- --------- --------- --------- ---------
> >> This message is posted to a newsgroup. Please post replies
> >> and questions to the newsgroup so that others can learn
> >> from my ignorance and your wisdom.
> >>
> >> "shanbones" <shanbones@discussions.microsoft.com> wrote in message
> >> news:BF010EFE-0497-4EB8-954F-25C2EE4D7B3B@microsoft.com...
> >> > Thank you for the info Doug. However, when I tried to run this macro
> >> > Visual
> >> > Basic comes up with a "Compile Error: Syntax Error" message window and
> >> > hightlights the following portion of the macro:
> >> >
> >> > .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor
> >> > =
> >> >
> >> > Any suggestions?
> >> > Thanks, Shannon
> >> >
> >> > "Doug Robbins" wrote:
> >> >
> >> >> Run the following macro on exit from each of the checkboxes:
> >> >>
> >> >> Dim ffname As String
> >> >> ffname = Selection.FormFields(1).Name
> >> >> With ActiveDocument
> >> >> .Unprotect
> >> >> If .FormFields(ffname).CheckBox.Value = True Then
> >> >>
> >> >> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
> >> >> wdColorAqua
> >> >> Else
> >> >>
> >> >> .Bookmarks(ffname).Range.Rows(1).Shading.BackgroundPatternColor =
> >> >> wdColorAutomatic
> >> >> End If
> >> >> .Protect wdAllowOnlyFormFields, noreset
> >> >> End With
> >> >>
> >> >>
> >> >> --
> >> >> Hope this helps.
> >> >>
> >> >> Please reply to the newsgroup unless you wish to avail yourself of my
> >> >> services on a paid consulting basis.
> >> >>
> >> >> Doug Robbins - Word MVP
> >> >> "shanbones" <shanbones@discussions.microsoft.com> wrote in message
> >> >> news:799D2C4E-8913-4303-BE06-550438F0A186@microsoft.com...
> >> >> >I have created a template form in Word 2002 (XP). In my form there is
> >> >> >a
> >> >> > table. One of the table's columns contains a checkbox in each row.
> >> >> > What
> >> >> > I
> >> >> > would like to have happen is that when the user checks the checkbox
> >> >> > the
> >> >> > row
> >> >> > that it is in will become highlighted/shaded. I am assuming that I
> >> >> > will
> >> >> > need
> >> >> > to do this with a macro, but I am not sure. If there is an easier
> >> >> > way
> >> >> > that
> >> >> > would be great! I am a macro novice so any assistance would be
> >> >> > greatly
> >> >> > appreciated.
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>