Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-17-2011, 12:17 PM
cksm4 cksm4 is offline InLineShapes Windows XP InLineShapes Office 2007
Advanced Beginner
InLineShapes
 
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
  #2  
Old 02-21-2011, 10:19 PM
cksm4 cksm4 is offline InLineShapes Windows XP InLineShapes Office 2007
Advanced Beginner
InLineShapes
 
Join Date: Aug 2010
Posts: 48
cksm4 is on a distinguished road
Default

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
Reply With Quote
Reply



Other Forums: Access Forums

All times are GMT -7. The time now is 07:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft