R
rob p
Thru the help of many of you, I have this following macro. If checkbox is
checked, make the text in that cell and the cell next to it bold. If not
checked, make the font gray. Works nicely.
I finish with a macro that sends the template to the printer, unlocks
template and then locks it again. This clears out all the checkboxs but if
the font was bold because it's checkbox was checked, it stays that way
unchecked after the unlock and lock. What I want to do is uncheck all the
boxes at once and make their adjoining cells gray. (I can't select the whole
doc because there are some fixed cells I need to stay bold.)
thanks.
Sub togglemulticells()
' run macro to unprotect
Let Col = 0
Let Row = 0
Col = Selection.Cells(1).ColumnIndex
Row = Selection.Cells(1).RowIndex
Set myTable = ActiveDocument.Tables(1)
Set myrange = ActiveDocument.Range(myTable.Cell(Row, Col) _
.Range.Start, myTable.Cell(Row, Col + 1).Range.End)
If Selection.FormFields.Item(1).CheckBox.Value = True Then
myrange.Font.Color = wdColorBlack ' works
Selection.Range.Bold = True
Else
myrange.Font.Color = wdColorGray50 ' works
'run macro to protect again...
End If
checked, make the text in that cell and the cell next to it bold. If not
checked, make the font gray. Works nicely.
I finish with a macro that sends the template to the printer, unlocks
template and then locks it again. This clears out all the checkboxs but if
the font was bold because it's checkbox was checked, it stays that way
unchecked after the unlock and lock. What I want to do is uncheck all the
boxes at once and make their adjoining cells gray. (I can't select the whole
doc because there are some fixed cells I need to stay bold.)
thanks.
Sub togglemulticells()
' run macro to unprotect
Let Col = 0
Let Row = 0
Col = Selection.Cells(1).ColumnIndex
Row = Selection.Cells(1).RowIndex
Set myTable = ActiveDocument.Tables(1)
Set myrange = ActiveDocument.Range(myTable.Cell(Row, Col) _
.Range.Start, myTable.Cell(Row, Col + 1).Range.End)
If Selection.FormFields.Item(1).CheckBox.Value = True Then
myrange.Font.Color = wdColorBlack ' works
Selection.Range.Bold = True
Else
myrange.Font.Color = wdColorGray50 ' works
'run macro to protect again...
End If