Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Class Module Scope

Howdy All,
Is it possible to create an object from a class module in
another workbook. I created a reference to the other
workbook, but that didn't do the trick.
TIA
Trent
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Class Module Scope

Trent,

You can change the instancing property of the class to "Public
Not Creatable" which will allow you to declare a variable of that
class type, but not create an instance of the class. In the
project that contains the class, create a public function in a
standard code module that create a new instance of the class and
returns a reference as its result.

For example,
' in the project that contains Class1
Public Function CreateClass () As Class1
Set CreateClass = New Class1
End Function

' in the project that need a Class1 variable
Dim C1 As ProjName.Class1
Set C1 = ProjName.CreateClass()


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Trent Argante" wrote in message
...
Howdy All,
Is it possible to create an object from a class module in
another workbook. I created a reference to the other
workbook, but that didn't do the trick.
TIA
Trent



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Class Module Scope

Chip,

That did the trick.
It's nice & clean, too.
Thank you, very much.

Trent

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Creating UDF by Class Module (Leo)? Leo Excel Discussion (Misc queries) 1 December 2nd 08 10:59 AM
CLASS MODULE & SIMPLE MODULE FARAZ QURESHI Excel Discussion (Misc queries) 1 September 7th 07 09:32 AM
Class module David Excel Programming 4 December 31st 03 01:58 PM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM
how to declare a class module Kevin Excel Programming 5 July 15th 03 01:04 AM


All times are GMT +1. The time now is 05:46 PM.

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

About Us

"It's about Microsoft Excel"