Public oMyClass As New MyProject.MyClass

  • Thread starter Thread starter OfficeUser
  • Start date Start date
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.
 
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)
 
Thanks for responding, Chip!

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

Thanks!
 
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)
 
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.
 
Back
Top