Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Within the first afternoon I found 2 of the 3 needed solutions, and the 3rd came to me over the weekend!..."

Geography

Where in the world do Tek-Tips members come from?
gr82btaz (TechnicalUser)
2 May 01 16:54
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
Helpful Member!  DarkSun (Programmer)
3 May 01 4:44
In the Userform try telling the code where the object is. eg.

Sheet1.oObject

When you type sheet1. the object should appear in the drop down box.
gr82btaz (TechnicalUser)
3 May 01 20:00
DarkSun,
After looking around for a way to give you feedback, and not finding anything direct, I will post an addendum here. I simply want to say, thank you very much. Your answer was exactly what I needed. It was a gap in my knowledge that I wouldn't have quickly sorted out on my own, so, again, thanks.
gr82btaz

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close