Folks,
The essence:
1. I'm instantiating an object from the code page of a sheet so I have access to
the object's events on the sheet, but...
2. I would like to use buttons on a UserForm to fire the object's member
functions, but when I try to, I get an error message saying, effectively, no
object exists (Run-time error '424': object required).
The question:
1.Is there a way to instantiate an object so that the object's events are
available to the code page of a sheet *and* the object's functions can be
accessed from a UserForm at the same time? How do I make it visible to both, if
I can?
The details:
1.I'm using Excel2000 under W98SE.
2.In the code page of the sheet I'm declaring my object variable like this:
Public WithEvents oObject As ComObject
****then later****
Set oObject = New ComObject
This launches the Object just fine. It seems from the literature and online
help, declaring *Public* should raise the scope to all modules and all projects.
3.The object is a COM/API object that I specify in Tools/References of the VBA
editor. I have no problems if I trigger its functions from command buttons on
the sheet, but I'm trying to avoid that.
4.I'm *not* using a standard module, or a class module, as these don't seem
suitable for instantiating a object.
If there's something wrong with this post, or it's just not succinct enough,
please let me know.
Chris
ih82bl8@my-deja.com
The essence:
1. I'm instantiating an object from the code page of a sheet so I have access to
the object's events on the sheet, but...
2. I would like to use buttons on a UserForm to fire the object's member
functions, but when I try to, I get an error message saying, effectively, no
object exists (Run-time error '424': object required).
The question:
1.Is there a way to instantiate an object so that the object's events are
available to the code page of a sheet *and* the object's functions can be
accessed from a UserForm at the same time? How do I make it visible to both, if
I can?
The details:
1.I'm using Excel2000 under W98SE.
2.In the code page of the sheet I'm declaring my object variable like this:
Public WithEvents oObject As ComObject
****then later****
Set oObject = New ComObject
This launches the Object just fine. It seems from the literature and online
help, declaring *Public* should raise the scope to all modules and all projects.
3.The object is a COM/API object that I specify in Tools/References of the VBA
editor. I have no problems if I trigger its functions from command buttons on
the sheet, but I'm trying to avoid that.
4.I'm *not* using a standard module, or a class module, as these don't seem
suitable for instantiating a object.
If there's something wrong with this post, or it's just not succinct enough,
please let me know.
Chris
ih82bl8@my-deja.com