Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-03-2011, 05:29 AM
waldux waldux is offline Runtime error 91 Windows XP Runtime error 91 Office 2010 32bit
Novice
Runtime error 91
 
Join Date: Mar 2011
Posts: 7
waldux is on a distinguished road
Default Runtime error 91

Hi,

I created userform which gives users ability to select one number from 1 to 10. After user clicks OK button, the number that he chose should be entered into the Textbox which is in the word document. This is the code that I'm using:



Code:
Private Sub CommandButton1_Click()
Dim oShape As Word.InlineShape
 
For Each oShape In ThisDocument.InlineShapes
If oShape.OLEFormat.Object.Name = "LabelA" Then
oShape.OLEFormat.Object.Caption = TextBox1.Value
End If
Next oShape
 
UserForm2.hide
End Sub
At the beginning of the day this code worked perfectly, however it started to throw error message something like 2 hours ago. Error message says that "Object variable or with block variable not set" and VBA indicates this error in the 5th line of the code (text "oShape.OLEFormat.Object.Name"). I really don't know why is this happening because I didn't change this code today and it worked fine at the start of the day.
Reply With Quote
  #2  
Old 03-04-2011, 11:25 PM
macropod's Avatar
macropod macropod is offline Runtime error 91 Windows 7 32bit Runtime error 91 Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Waldux,

an InLineShape's '.OLEFormat.Object' property has no 'Name' or 'Caption' sub-property. Hence the error. I would therefore be surprised if the code as posted ever worked.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Visual Basic error - run time error 504 crazymorton Word 11 01-13-2012 04:32 AM
Runtime error 5487 - Word cannot complete the save to to file permission error franferns Word 0 11-25-2009 05:35 AM
Receive error cannot open this form because an error occurred in BCM 2007 bornhusker Outlook 0 06-01-2009 10:28 AM
Runtime error 91 access runtime application will not install markjean Office 1 12-06-2005 02:15 AM
Installing Access Runtime ziggy0508 Office 1 09-29-2005 04:21 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:31 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