Good morning,

I have created a protected form in which there are currently 2 tables.

In the 8th row of the first table I have two check boxes (which by code are
mutually exclusive). However, I would like to control, based on the
selection made, the backcolor of the 9th row (which also happens to be the
last row in the table) of this table. Could someone show me how this is
done?! Below is my non-functional code.

************************************************************
Sub ToggleCheckBoxOnEntry()

Dim fFields As FormFields
Dim fSelectedField As FormField

Set fFields = ActiveDocument.FormFields

For Each fSelectedField In Selection.FormFields

' Form field must be a check box.
If fSelectedField.Type = wdFieldFormCheckBox Then

' Go to the case for the currently selected group.
Select Case fSelectedField.Name

'Check box group.
Case "Chk_Paper", "Chk_Electronic"
' Clear all values.
fFields("Chk_Paper").CheckBox.Value = False
fFields("Chk_Electronic").CheckBox.Value = False

Case "Chk_Original", "Chk_Copy"
' Clear all values.
fFields("Chk_Original").CheckBox.Value = False
fFields("Chk_Copy").CheckBox.Value = False

End Select

' Check the selected formfield.
fSelectedField.CheckBox.Value = True

If fFields("Chk_Electronic").CheckBox.Value = True Then
'fFields("Chk_Original").Enabled = False
'fFields("Chk_Copy").Enabled = False
ActiveDocument.Tables(1).Rows.Last.Select
With Selection
.Cells.Borders.InsideColor = 1
End With


End If

End If

Next

End Sub
************************************************************

Thank you the help,

Daniel

Re: Pattern Color of next row in table by Doug

Doug
Tue May 24 13:00:01 CDT 2005

ActiveDocument.Tables(1).Rows(9).Range.Shading.BackgroundPatternColor =
wdColorAqua


--
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
"Daniel" <Daniel@discussions.microsoft.com> wrote in message
news:314DD8D9-F400-4F18-B70B-A7124A51AA81@microsoft.com...
> Good morning,
>
> I have created a protected form in which there are currently 2 tables.
>
> In the 8th row of the first table I have two check boxes (which by code
> are
> mutually exclusive). However, I would like to control, based on the
> selection made, the backcolor of the 9th row (which also happens to be the
> last row in the table) of this table. Could someone show me how this is
> done?! Below is my non-functional code.
>
> ************************************************************
> Sub ToggleCheckBoxOnEntry()
>
> Dim fFields As FormFields
> Dim fSelectedField As FormField
>
> Set fFields = ActiveDocument.FormFields
>
> For Each fSelectedField In Selection.FormFields
>
> ' Form field must be a check box.
> If fSelectedField.Type = wdFieldFormCheckBox Then
>
> ' Go to the case for the currently selected group.
> Select Case fSelectedField.Name
>
> 'Check box group.
> Case "Chk_Paper", "Chk_Electronic"
> ' Clear all values.
> fFields("Chk_Paper").CheckBox.Value = False
> fFields("Chk_Electronic").CheckBox.Value = False
>
> Case "Chk_Original", "Chk_Copy"
> ' Clear all values.
> fFields("Chk_Original").CheckBox.Value = False
> fFields("Chk_Copy").CheckBox.Value = False
>
> End Select
>
> ' Check the selected formfield.
> fSelectedField.CheckBox.Value = True
>
> If fFields("Chk_Electronic").CheckBox.Value = True Then
> 'fFields("Chk_Original").Enabled = False
> 'fFields("Chk_Copy").Enabled = False
> ActiveDocument.Tables(1).Rows.Last.Select
> With Selection
> .Cells.Borders.InsideColor = 1
> End With
>
>
> End If
>
> End If
>
> Next
>
> End Sub
> ************************************************************
>
> Thank you the help,
>
> Daniel



Re: Pattern Color of next row in table by Daniel

Daniel
Wed May 25 08:45:34 CDT 2005

Word keep generating an error "command not available" and crashes. Is it
because the form is protected? Is there a way around this problem?

Daniel

"Doug Robbins" wrote:

> ActiveDocument.Tables(1).Rows(9).Range.Shading.BackgroundPatternColor =
> wdColorAqua
>
>
> --
> 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
> "Daniel" <Daniel@discussions.microsoft.com> wrote in message
> news:314DD8D9-F400-4F18-B70B-A7124A51AA81@microsoft.com...
> > Good morning,
> >
> > I have created a protected form in which there are currently 2 tables.
> >
> > In the 8th row of the first table I have two check boxes (which by code
> > are
> > mutually exclusive). However, I would like to control, based on the
> > selection made, the backcolor of the 9th row (which also happens to be the
> > last row in the table) of this table. Could someone show me how this is
> > done?! Below is my non-functional code.
> >
> > ************************************************************
> > Sub ToggleCheckBoxOnEntry()
> >
> > Dim fFields As FormFields
> > Dim fSelectedField As FormField
> >
> > Set fFields = ActiveDocument.FormFields
> >
> > For Each fSelectedField In Selection.FormFields
> >
> > ' Form field must be a check box.
> > If fSelectedField.Type = wdFieldFormCheckBox Then
> >
> > ' Go to the case for the currently selected group.
> > Select Case fSelectedField.Name
> >
> > 'Check box group.
> > Case "Chk_Paper", "Chk_Electronic"
> > ' Clear all values.
> > fFields("Chk_Paper").CheckBox.Value = False
> > fFields("Chk_Electronic").CheckBox.Value = False
> >
> > Case "Chk_Original", "Chk_Copy"
> > ' Clear all values.
> > fFields("Chk_Original").CheckBox.Value = False
> > fFields("Chk_Copy").CheckBox.Value = False
> >
> > End Select
> >
> > ' Check the selected formfield.
> > fSelectedField.CheckBox.Value = True
> >
> > If fFields("Chk_Electronic").CheckBox.Value = True Then
> > 'fFields("Chk_Original").Enabled = False
> > 'fFields("Chk_Copy").Enabled = False
> > ActiveDocument.Tables(1).Rows.Last.Select
> > With Selection
> > .Cells.Borders.InsideColor = 1
> > End With
> >
> >
> > End If
> >
> > End If
> >
> > Next
> >
> > End Sub
> > ************************************************************
> >
> > Thank you the help,
> >
> > Daniel
>
>
>

Re: Pattern Color of next row in table by Doug

Doug
Wed May 25 15:11:47 CDT 2005

Add

ActiveDocument.Unprotect

before that code, and

ActiveDocument.Protect wdAllowOnlyFormfields, NoReset

after it.

--
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
"Daniel" <Daniel@discussions.microsoft.com> wrote in message
news:54086D42-A73A-4A88-8F0A-D26E1B1B98E2@microsoft.com...
> Word keep generating an error "command not available" and crashes. Is it
> because the form is protected? Is there a way around this problem?
>
> Daniel
>
> "Doug Robbins" wrote:
>
>> ActiveDocument.Tables(1).Rows(9).Range.Shading.BackgroundPatternColor =
>> wdColorAqua
>>
>>
>> --
>> 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
>> "Daniel" <Daniel@discussions.microsoft.com> wrote in message
>> news:314DD8D9-F400-4F18-B70B-A7124A51AA81@microsoft.com...
>> > Good morning,
>> >
>> > I have created a protected form in which there are currently 2 tables.
>> >
>> > In the 8th row of the first table I have two check boxes (which by
>> > code
>> > are
>> > mutually exclusive). However, I would like to control, based on the
>> > selection made, the backcolor of the 9th row (which also happens to be
>> > the
>> > last row in the table) of this table. Could someone show me how this
>> > is
>> > done?! Below is my non-functional code.
>> >
>> > ************************************************************
>> > Sub ToggleCheckBoxOnEntry()
>> >
>> > Dim fFields As FormFields
>> > Dim fSelectedField As FormField
>> >
>> > Set fFields = ActiveDocument.FormFields
>> >
>> > For Each fSelectedField In Selection.FormFields
>> >
>> > ' Form field must be a check box.
>> > If fSelectedField.Type = wdFieldFormCheckBox Then
>> >
>> > ' Go to the case for the currently selected group.
>> > Select Case fSelectedField.Name
>> >
>> > 'Check box group.
>> > Case "Chk_Paper", "Chk_Electronic"
>> > ' Clear all values.
>> > fFields("Chk_Paper").CheckBox.Value = False
>> > fFields("Chk_Electronic").CheckBox.Value = False
>> >
>> > Case "Chk_Original", "Chk_Copy"
>> > ' Clear all values.
>> > fFields("Chk_Original").CheckBox.Value = False
>> > fFields("Chk_Copy").CheckBox.Value = False
>> >
>> > End Select
>> >
>> > ' Check the selected formfield.
>> > fSelectedField.CheckBox.Value = True
>> >
>> > If fFields("Chk_Electronic").CheckBox.Value = True Then
>> > 'fFields("Chk_Original").Enabled = False
>> > 'fFields("Chk_Copy").Enabled = False
>> > ActiveDocument.Tables(1).Rows.Last.Select
>> > With Selection
>> > .Cells.Borders.InsideColor = 1
>> > End With
>> >
>> >
>> > End If
>> >
>> > End If
>> >
>> > Next
>> >
>> > End Sub
>> > ************************************************************
>> >
>> > Thank you the help,
>> >
>> > Daniel
>>
>>
>>



Re: Pattern Color of next row in table by Daniel

Daniel
Thu May 26 09:21:06 CDT 2005

Doug,

It work like a charm with that addition. Thank you for your help.

I have a follow up question to this one. I have a really hard time
understanding the indexing of table..... in word and how to work with them in
coding. Is there a good website that covers this that you might recommend?

Thank you once again,

Daniel



"Doug Robbins" wrote:

> Add
>
> ActiveDocument.Unprotect
>
> before that code, and
>
> ActiveDocument.Protect wdAllowOnlyFormfields, NoReset
>
> after it.
>
> --
> 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
> "Daniel" <Daniel@discussions.microsoft.com> wrote in message
> news:54086D42-A73A-4A88-8F0A-D26E1B1B98E2@microsoft.com...
> > Word keep generating an error "command not available" and crashes. Is it
> > because the form is protected? Is there a way around this problem?
> >
> > Daniel
> >
> > "Doug Robbins" wrote:
> >
> >> ActiveDocument.Tables(1).Rows(9).Range.Shading.BackgroundPatternColor =
> >> wdColorAqua
> >>
> >>
> >> --
> >> 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
> >> "Daniel" <Daniel@discussions.microsoft.com> wrote in message
> >> news:314DD8D9-F400-4F18-B70B-A7124A51AA81@microsoft.com...
> >> > Good morning,
> >> >
> >> > I have created a protected form in which there are currently 2 tables.
> >> >
> >> > In the 8th row of the first table I have two check boxes (which by
> >> > code
> >> > are
> >> > mutually exclusive). However, I would like to control, based on the
> >> > selection made, the backcolor of the 9th row (which also happens to be
> >> > the
> >> > last row in the table) of this table. Could someone show me how this
> >> > is
> >> > done?! Below is my non-functional code.
> >> >
> >> > ************************************************************
> >> > Sub ToggleCheckBoxOnEntry()
> >> >
> >> > Dim fFields As FormFields
> >> > Dim fSelectedField As FormField
> >> >
> >> > Set fFields = ActiveDocument.FormFields
> >> >
> >> > For Each fSelectedField In Selection.FormFields
> >> >
> >> > ' Form field must be a check box.
> >> > If fSelectedField.Type = wdFieldFormCheckBox Then
> >> >
> >> > ' Go to the case for the currently selected group.
> >> > Select Case fSelectedField.Name
> >> >
> >> > 'Check box group.
> >> > Case "Chk_Paper", "Chk_Electronic"
> >> > ' Clear all values.
> >> > fFields("Chk_Paper").CheckBox.Value = False
> >> > fFields("Chk_Electronic").CheckBox.Value = False
> >> >
> >> > Case "Chk_Original", "Chk_Copy"
> >> > ' Clear all values.
> >> > fFields("Chk_Original").CheckBox.Value = False
> >> > fFields("Chk_Copy").CheckBox.Value = False
> >> >
> >> > End Select
> >> >
> >> > ' Check the selected formfield.
> >> > fSelectedField.CheckBox.Value = True
> >> >
> >> > If fFields("Chk_Electronic").CheckBox.Value = True Then
> >> > 'fFields("Chk_Original").Enabled = False
> >> > 'fFields("Chk_Copy").Enabled = False
> >> > ActiveDocument.Tables(1).Rows.Last.Select
> >> > With Selection
> >> > .Cells.Borders.InsideColor = 1
> >> > End With
> >> >
> >> >
> >> > End If
> >> >
> >> > End If
> >> >
> >> > Next
> >> >
> >> > End Sub
> >> > ************************************************************
> >> >
> >> > Thank you the help,
> >> >
> >> > Daniel
> >>
> >>
> >>
>
>
>

Re: Pattern Color of next row in table by Doug

Doug
Thu May 26 13:45:19 CDT 2005

What do you mean by "indexing of a table"?

--
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
"Daniel" <Daniel@discussions.microsoft.com> wrote in message
news:D9F898FE-850A-44D7-BC85-4D894699F860@microsoft.com...
> Doug,
>
> It work like a charm with that addition. Thank you for your help.
>
> I have a follow up question to this one. I have a really hard time
> understanding the indexing of table..... in word and how to work with them
> in
> coding. Is there a good website that covers this that you might
> recommend?
>
> Thank you once again,
>
> Daniel
>
>
>
> "Doug Robbins" wrote:
>
>> Add
>>
>> ActiveDocument.Unprotect
>>
>> before that code, and
>>
>> ActiveDocument.Protect wdAllowOnlyFormfields, NoReset
>>
>> after it.
>>
>> --
>> 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
>> "Daniel" <Daniel@discussions.microsoft.com> wrote in message
>> news:54086D42-A73A-4A88-8F0A-D26E1B1B98E2@microsoft.com...
>> > Word keep generating an error "command not available" and crashes. Is
>> > it
>> > because the form is protected? Is there a way around this problem?
>> >
>> > Daniel
>> >
>> > "Doug Robbins" wrote:
>> >
>> >> ActiveDocument.Tables(1).Rows(9).Range.Shading.BackgroundPatternColor
>> >> =
>> >> wdColorAqua
>> >>
>> >>
>> >> --
>> >> 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
>> >> "Daniel" <Daniel@discussions.microsoft.com> wrote in message
>> >> news:314DD8D9-F400-4F18-B70B-A7124A51AA81@microsoft.com...
>> >> > Good morning,
>> >> >
>> >> > I have created a protected form in which there are currently 2
>> >> > tables.
>> >> >
>> >> > In the 8th row of the first table I have two check boxes (which by
>> >> > code
>> >> > are
>> >> > mutually exclusive). However, I would like to control, based on the
>> >> > selection made, the backcolor of the 9th row (which also happens to
>> >> > be
>> >> > the
>> >> > last row in the table) of this table. Could someone show me how
>> >> > this
>> >> > is
>> >> > done?! Below is my non-functional code.
>> >> >
>> >> > ************************************************************
>> >> > Sub ToggleCheckBoxOnEntry()
>> >> >
>> >> > Dim fFields As FormFields
>> >> > Dim fSelectedField As FormField
>> >> >
>> >> > Set fFields = ActiveDocument.FormFields
>> >> >
>> >> > For Each fSelectedField In Selection.FormFields
>> >> >
>> >> > ' Form field must be a check box.
>> >> > If fSelectedField.Type = wdFieldFormCheckBox Then
>> >> >
>> >> > ' Go to the case for the currently selected group.
>> >> > Select Case fSelectedField.Name
>> >> >
>> >> > 'Check box group.
>> >> > Case "Chk_Paper", "Chk_Electronic"
>> >> > ' Clear all values.
>> >> > fFields("Chk_Paper").CheckBox.Value = False
>> >> > fFields("Chk_Electronic").CheckBox.Value = False
>> >> >
>> >> > Case "Chk_Original", "Chk_Copy"
>> >> > ' Clear all values.
>> >> > fFields("Chk_Original").CheckBox.Value = False
>> >> > fFields("Chk_Copy").CheckBox.Value = False
>> >> >
>> >> > End Select
>> >> >
>> >> > ' Check the selected formfield.
>> >> > fSelectedField.CheckBox.Value = True
>> >> >
>> >> > If fFields("Chk_Electronic").CheckBox.Value = True Then
>> >> > 'fFields("Chk_Original").Enabled = False
>> >> > 'fFields("Chk_Copy").Enabled = False
>> >> > ActiveDocument.Tables(1).Rows.Last.Select
>> >> > With Selection
>> >> > .Cells.Borders.InsideColor = 1
>> >> > End With
>> >> >
>> >> >
>> >> > End If
>> >> >
>> >> > End If
>> >> >
>> >> > Next
>> >> >
>> >> > End Sub
>> >> > ************************************************************
>> >> >
>> >> > Thank you the help,
>> >> >
>> >> > Daniel
>> >>
>> >>
>> >>
>>
>>
>>