![]() |
|
|
|
#1
|
|||
|
|||
|
Hello all,
Running the below code causes run-time error 91 (Object variable or With block variable not set). I am trying to find inlineshapes which are checkbox and perform a task when found. The problem I am finding is that the presence of any other inlineshapes causes the run-time error. Not sure how this is happening as the code is written to only run on checkboxes. Any ideas:/? Code:
Dim inls As InlineShape
For Each inls In ActiveDocument.InlineShapes
If inls.OLEFormat.ClassType = "Forms.CheckBox.1" Then
If inls.OLEFormat.Object.Value = True Then
inls.Select
Selection.MoveStart Unit:=wdRow, Count:=0
Selection.MoveEnd Unit:=wdRow, Count:=13
Selection.Font.Hidden = True
Else
inls.Select
Selection.SelectRow
Selection.Font.Hidden = True
End If
End If
Next
|
|
#2
|
|||
|
|||
|
If anyone has the same problem... the only way I was able to get this to work is by skipping pictures:
Code:
For Each inls In ActiveDocument.InlineShapes If Not inls.Type = wdInlineShapePicture Then If inls.OLEFormat.ClassType = "Forms.CheckBox.1" Then If inls.OLEFormat.Object.Value = True Then inls.Select Selection.MoveStart Unit:=wdRow, Count:=0 Selection.MoveEnd Unit:=wdRow, Count:=13 Selection.Font.Hidden = True Else inls.Select Selection.SelectRow Selection.Font.Hidden = True End If End If End If Next |
|
|
|