Public oMyClass As New MyProject.MyClass

O

OfficeUser

I have an .ocx file named MyProject. It contains a class named MyClass which
contains two VBA functions. MyProject is referenced in Tools-References.
Where do I put this line of code:
Public oMyClass As New MyProject.MyClass
so the following occurs:
Anywhere in your Code you should now be able (supported by intellisense), to
type oMyClass. .... and as soon as you type that, your list of functions
inside MyClass should pop up and be usable inside VBA.
 
C

Chip Pearson

Make sure that MyClass is Public and creatable. Then, you should be able to
put the declaration in the "Declarations" section of a code module (NOT an
object module like a class or ThisWorkbook), outside of and before any proc
in that module.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
O

OfficeUser

Thanks for responding, Chip!

What do you mean by "Make sure that MyClass is Public and creatable"? How do
I do that?

Thanks!
 
C

Chip Pearson

It is the Instancing property (accessible in the Properties window of VB) of
the class. The property can be Private, PublicNotCreatable, MultiUse or
Global MultiUse. You want to make sure that it is not Private or
PublicNotCreatable.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
O

OfficeUser

Thanks, Chip!

BTW, I read a lot of the threads here and see you responding to a goodly
number if questions. You are always very courteous and professional. I like
how you end all your responses with "Cordially"!!

Thanks for all the time you put into this newsgroup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top