runtime error 91 object variable or With block variable not set

Reply

Join Date: Aug 2006
Posts: 1
Reputation: ronb is an unknown quantity at this point 
Solved Threads: 0
ronb ronb is offline Offline
Newbie Poster

runtime error 91 object variable or With block variable not set

 
0
  #1
Aug 1st, 2006
i wrote and compiled an vb 6 program on a windows xp sp2 box
i am trying to run the program via a batch file from an nt box
i get this error:
runtime error 91:
object variable or With block variable not set
the program runs under the scheduler on xp, and in debug in vb ide
thanks in advance for the help
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: runtime error 91 object variable or With block variable not set

 
0
  #2
Aug 1st, 2006
It's possible that you are trying to create an instance of a class (an object) from a class that is present on the machines you tested it on, but not on the machine it's been deployed to..... for example, I happen to know that I can make a VB program utilize a class for Nero Burning Rom.... I can make a nero object, and use it's methods and properties...... but that will only work on machines that have the Nero libraries installed. If it's not installed, when you try to make the object (either through early or late bindings with new or createobject), the variable that SHOULD refer to the object is still set to Nothing, because the library failed to create an instance of the requested class.....

Basically, you are trying to make an object from a class that doesn't exist on the NT box.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 1
Reputation: ibrahim refaat is an unknown quantity at this point 
Solved Threads: 0
ibrahim refaat ibrahim refaat is offline Offline
Newbie Poster

Re: runtime error 91 object variable or With block variable not set

 
0
  #3
Mar 24th, 2007
when i want to setup certain program this messege appear
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 59
Reputation: PVBert is an unknown quantity at this point 
Solved Threads: 5
PVBert PVBert is offline Offline
Junior Poster in Training

Re: runtime error 91 object variable or With block variable not set

 
0
  #4
Mar 24th, 2007
in vb ide build an exe file
get a dependency walker and check which dependencies are needed for your exe file
create those dependencies on youre target machine
OR
get a setup (e.g. setupfactory) tool that builds a setup which does this for you
it can make a cabin file on development machine
that you can deploy on your target machine
Last edited by PVBert; Mar 24th, 2007 at 1:18 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 1
Reputation: akodalikar is an unknown quantity at this point 
Solved Threads: 0
akodalikar akodalikar is offline Offline
Newbie Poster

Re: runtime error 91 object variable or With block variable not set

 
0
  #5
Jul 1st, 2008
According to the MSDN library...
Error 91: Object variable or With block variable not set
---
There are two steps to creating an object variable. First you must declare
the object variable. Then you must assign a valid reference to the object
variable using the Set statement. Similarly, a With...End With block must be
initialized by executing the With statement entry point. This error has the
following causes and solutions:

You attempted to use an object variable that isn't yet referencing a valid
object.
Specify or respecify a reference for the object variable. For example, if
the Set statement is omitted in the following code, an error would be
generated on the reference to MyObject:

Dim MyObject As Object ' Create object variable.
Set MyObject = Sheets(1) ' Create valid object reference.
MyCount = MyObject.Count ' Assign Count value to MyCount.

You attempted to use an object variable that has been set to Nothing.
Set MyObject = Nothing ' Release the object.
MyCount = MyObject.Count ' Make a reference to a released object.

Respecify a reference for the object variable. For example, use a new Set
statement to set a new reference to the object.

The object is a valid object, but it wasn't set because the object library
in which it is described hasn't been selected in the References dialog box.
Select the object library in the Add References dialog box.

The target of a GoTo statement is inside a With block.
Don't jump into a With block. Make sure the block is initialized by
executing the With statement entry point.










Originally Posted by ronb View Post
i wrote and compiled an vb 6 program on a windows xp sp2 box
i am trying to run the program via a batch file from an nt box
i get this error:
runtime error 91:
object variable or With block variable not set
the program runs under the scheduler on xp, and in debug in vb ide
thanks in advance for the help
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 11
Reputation: avisek_cts is an unknown quantity at this point 
Solved Threads: 0
avisek_cts avisek_cts is offline Offline
Newbie Poster

Re: runtime error 91 object variable or With block variable not set

 
0
  #6
Jul 22nd, 2009
Private Sub Command1_Click()
Dim PDDoc As Object
Dim AVDoc As Object
Dim AcroExchApp As Object
Dim PDSaveFull As Object
AcroExchApp.GetActiveDoc
Set AcroExchApp = CreateObject("AcroExch.App")
AcroExchApp.GetActiveDoc
AVDoc.GetPDDoc
PDDoc.Save

Set PDDoc = AVDoc.GetPDDoc

If PDDoc.Save(PDSaveFull, "c:\test.pdf") = False Then
MsgBox "Unable to save image"
Else: MsgBox "The file is saved"
End If


End Sub

getting an error 91 whats wrong plzz help
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 805
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 146
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: runtime error 91 object variable or With block variable not set

 
0
  #7
Jul 22nd, 2009
abisek_cts,

In the future please create your own thread and if you need to, copy the older threads url that you want to reference into your post.

Also please use code tags when submitting code. [ code ]your code goes here[ /code ] (without spaces as shown)

Now, I think you need to switch these two lines...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. AcroExchApp.GetActiveDoc
  2. Set AcroExchApp = CreateObject("AcroExch.App")
to
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Set AcroExchApp = CreateObject("AcroExch.App")
  2. AcroExchApp.GetActiveDoc
because you have not create the object yet and are trying to give it a command.


Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 11
Reputation: avisek_cts is an unknown quantity at this point 
Solved Threads: 0
avisek_cts avisek_cts is offline Offline
Newbie Poster

Re: runtime error 91 object variable or With block variable not set

 
0
  #8
Jul 23rd, 2009
will remeber it
can u send me the code what to write please...
the full code
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 805
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 146
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark

Re: runtime error 91 object variable or With block variable not set

 
0
  #9
Jul 23rd, 2009
You posted the code...
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 6
Reputation: markperfinan is an unknown quantity at this point 
Solved Threads: 0
markperfinan markperfinan is offline Offline
Newbie Poster

Re: runtime error 91 object variable or With block variable not set

 
0
  #10
Jul 24th, 2009
I don't think that you have to use the Set keyword because it is understood automatically by the compiler in assigning values to a variable. I also get the same problem but I think the error comes from the referencing of the assigned variable.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC