Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Public oMyClass As New MyProject.MyClass

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Public oMyClass As New MyProject.MyClass

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)

"OfficeUser" wrote in message
...
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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Public oMyClass As New MyProject.MyClass

Thanks for responding, Chip!

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

Thanks!



"Chip Pearson" wrote in message
...
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)

"OfficeUser" wrote in message
...
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.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Public oMyClass As New MyProject.MyClass

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)


"OfficeUser" wrote in message
...
Thanks for responding, Chip!

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

Thanks!



"Chip Pearson" wrote in message
...
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)

"OfficeUser" wrote in message
...
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.





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Public oMyClass As New MyProject.MyClass

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.


"Chip Pearson" wrote in message
...
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)


"OfficeUser" wrote in message
...
Thanks for responding, Chip!

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

Thanks!



"Chip Pearson" wrote in message
...
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)

"OfficeUser" wrote in message
...
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.









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Public is not Public clara Excel Programming 4 May 18th 07 03:21 PM
Use of PUBLIC BillCPA Excel Programming 6 June 7th 06 01:41 PM
Dim vs. Public Jason Morin Excel Programming 7 January 27th 05 01:13 PM
public sub Bob Excel Programming 3 December 10th 04 08:49 PM
Public Sub Help No Name Excel Programming 2 May 18th 04 11:09 PM


All times are GMT +1. The time now is 03:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"