| | |
runtime error 91 object variable or With block variable not set
![]() |
•
•
Join Date: Aug 2006
Posts: 1
Reputation:
Solved Threads: 0
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
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
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.
Basically, you are trying to make an object from a class that doesn't exist on the NT box.
•
•
Join Date: Mar 2007
Posts: 59
Reputation:
Solved Threads: 5
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
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.
•
•
Join Date: Jun 2008
Posts: 1
Reputation:
Solved Threads: 0
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.
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.
•
•
•
•
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
•
•
Join Date: Jun 2009
Posts: 11
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Mar 2009
Posts: 805
Reputation:
Solved Threads: 146
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...
to
because you have not create the object yet and are trying to give it a command.
Good Luck
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)
AcroExchApp.GetActiveDoc Set AcroExchApp = CreateObject("AcroExch.App")
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Set AcroExchApp = CreateObject("AcroExch.App") AcroExchApp.GetActiveDoc
Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.
Thanks
Thanks
![]() |
Similar Threads
- 'Object variable or With block variable not set' Error (ASP.NET)
- word 2003 VB error 91 when closing (Windows Software)
- Runtime error:453 cannot find dllentrypoint (Visual Basic 4 / 5 / 6)
- Control arrays (Visual Basic 4 / 5 / 6)
- VB.NET Web service using COM component - "Object variable or With block variable ..." (VB.NET)
- object variable or with block variable not set (Community Introductions)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: how to obtain windows serial number programmatically
- Next Thread: Can help me check this why can get data from the sql
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






