Thread: InLineShapes
View Single Post
 
Old 02-17-2011, 12:17 PM
cksm4 cksm4 is offline Windows XP Office 2007
Advanced Beginner
 
Join Date: Aug 2010
Posts: 48
cksm4 is on a distinguished road
Default InLineShapes

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
A big thanks for any help!
Reply With Quote