LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Class Module

I managed to get to this late today, and it worked very nicely. Thanks for your
assistance.

Bill
----------------------------
Chip Pearson wrote:
You can't directly share a class module between projects. You
can, however, have a public function in the workbook that
contains the class that returns as its result a new instance of
the class. For example, suppose WB1.xls has a project name of
MyProj and a class named CMyClass.

Then, set a reference from WB2.xls to WB1.xls (in VBA go to the
Tool menu, choose References, and check MyProj). Then in a code
module in WB1.xls, create a function

Public Function GetClass As CMyClass
Set GetClass = New CMyClasss
End Function

In WB2.xls, instantiate the class with code like

Public Sub AAA()
Dim C As MyProj.CMyClass
Set C = MyProj.GetClass
' more code
End Sub

Ensure that the Instancing Property of the Class is
PublicNotCreatable, not Private.

 
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
CLASS MODULE & SIMPLE MODULE FARAZ QURESHI Excel Discussion (Misc queries) 1 September 7th 07 09:32 AM
Class module Chip Pearson Excel Programming 0 January 19th 05 03:01 PM
Class module Mark[_36_] Excel Programming 2 February 17th 04 03:14 PM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM


All times are GMT +1. The time now is 07:11 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"