R
rob p
I needed to suppress (I changed to gray instead) text in cells in checkbox
not checked along with the three cells next to it. Bold text if checked.
Astrid helped me out with code. I needed to change the cells next to the
checkbox too.
Here is what I have. (Toggleprotectdocument turns on / off lock). On a
simple table this macro works.
On a more complicated table with many varying sized cells, the first
checkbox seems to work. Going to the next checkbox, I then get an error 4120
bad parameter on the line with stars.
How can I tighten up the code / and further debug. Showing me that line
isn't helping. I can't see what is wrong. I seem to get the error with the
box checked or not. Also macro runs on exit.
Thanks.
Sub togglemulticells()
Let col = 0
Let Row = 0
col = Selection.Cells(1).ColumnIndex ' find cell I am
in and 3 over for range
Row = Selection.Cells(1).RowIndex ' find row
Set myTable = ActiveDocument.Tables(1)
Set myrange = ActiveDocument.Range(myTable.Cell(Row, col) _
.Range.Start, myTable.Cell(Row, col + 3).Range.End)
ToggleProtectDocument
MsgBox Row
MsgBox col
*** If ActiveDocument.FormFields(FormfieldName()).CheckBox.Value = True
Then ***
myrange.Font.Color = wdColorBlack ' works
Else
myrange.Font.Color = wdColorGray50 ' works
End If
ToggleProtectDocument
End Sub
not checked along with the three cells next to it. Bold text if checked.
Astrid helped me out with code. I needed to change the cells next to the
checkbox too.
Here is what I have. (Toggleprotectdocument turns on / off lock). On a
simple table this macro works.
On a more complicated table with many varying sized cells, the first
checkbox seems to work. Going to the next checkbox, I then get an error 4120
bad parameter on the line with stars.
How can I tighten up the code / and further debug. Showing me that line
isn't helping. I can't see what is wrong. I seem to get the error with the
box checked or not. Also macro runs on exit.
Thanks.
Sub togglemulticells()
Let col = 0
Let Row = 0
col = Selection.Cells(1).ColumnIndex ' find cell I am
in and 3 over for range
Row = Selection.Cells(1).RowIndex ' find row
Set myTable = ActiveDocument.Tables(1)
Set myrange = ActiveDocument.Range(myTable.Cell(Row, col) _
.Range.Start, myTable.Cell(Row, col + 3).Range.End)
ToggleProtectDocument
MsgBox Row
MsgBox col
*** If ActiveDocument.FormFields(FormfieldName()).CheckBox.Value = True
Then ***
myrange.Font.Color = wdColorBlack ' works
Else
myrange.Font.Color = wdColorGray50 ' works
End If
ToggleProtectDocument
End Sub