LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Custom Class and Properties


Earlier I asked what the best way to clone a spreadsheet was and was
told to use a Class module.

I've eventually come up with the following which appears to work quite
well. If this is the wrong approach could you please let me know:

Create a class module clsGutter:


Code:
--------------------

Option Explicit

Public WithEvents Gutter As Application
'*
Const c_Sbw_Angle_R = "$C$18"
...
...
Private Sub Gutter_SheetActivate(ByVal sh As Object)
Call Gutter_Activate(sh)
End Sub
Private Sub Gutter_SheetChange(ByVal sh As Object, ByVal Target As Range)
Call Gutter_Change(sh, Target)
End Sub

Private Sub Gutter_SheetSelectionChange(ByVal sh As Object, ByVal Target As Range)
Call Gutter_SelectionChange(sh, Target)
End Sub
...
...
...
Public Property Get Angle_R() As Double
Angle_R = Range(Angle_R_Address()).Value
End Property
Public Property Let Angle_R(New_Value As Double)
Range(Angle_R_Address()).Value = New_Value
End Property
Public Property Get Insulation_Type_Address() As String
Insulation_Type_Address = c_sbw_Insulation_Type
End Property

--------------------


In a standard module I have a public object:


Code:
--------------------

Public Gutter_Sheet As New clsGutter

--------------------


And during the Workbook_Open event I call the following procedu


Code:
--------------------

Sub Trap_Application_Events()
Set Gutter_Sheet.Gutter = Application
End Sub

--------------------


This all works fine with the application events being trapped by the
new class, so as each new worksheet is added to the work book they
behave in an identical way with all the events in place and being
called.

However, even though I have declared the properties of the class as
public, the macros complain that they do not exist:


Code:
--------------------

Sub Gutter_Activate(ByVal This_Sheet As Object)
If This_Sheet.Name < "Header" And This_Sheet.Name < "Customer Details" Then
Range(This_Sheet.Insulation_Type_Address()).Activa te
End If
Call Check_Data_Entry(ActiveCell)
End Sub

--------------------


This code causes a run time error 438 - "object doesn't support this
property or method" even though the Gutter class is active and the
property get has been declared as public.

Where am I going wrong ??

Cheers,

Rich


--
Rich_z
------------------------------------------------------------------------
Rich_z's Profile: http://www.excelforum.com/member.php...o&userid=24737
View this thread: http://www.excelforum.com/showthread...hreadid=386379

 
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
Custom Spreadsheet Properties Rod Excel Worksheet Functions 0 February 23rd 10 07:08 PM
Custom File Properties Ade Hodgetts Excel Discussion (Misc queries) 2 April 2nd 08 10:34 PM
Custom File Properties jujuwillis Excel Discussion (Misc queries) 1 August 1st 05 04:18 PM
Specify which method is default in custom class Bing Excel Programming 1 December 23rd 04 10:33 PM
Custom Properties DavidW[_2_] Excel Programming 9 July 1st 04 03:31 PM


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