Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform level class instance doesn't recognize methods
Hello,
I have a class (csList) with several properties and methods and I need to have it "publicly" available within the routines of a userform. When I use "Public|Private ls As New csList" at the top of the userform code and reference the methods in any of the userform routines as "ls.method" it tells me Method or Data Member not found (Autocompletion doesn't recognize them either). I've also tried removing the New statement and using a "Set ls = New csList" line in the userform code, but the same thing happened. What am I doing wrong? Thanks, =Ray= |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform level class instance doesn't recognize methods
Hi Ray,
With the following everything works as expected, including the intellisense ' code userform1 Private ls As New csList Private Sub UserForm_Click() MsgBox ls.propFlag Me.Caption = ls.fncTest End Sub Private Sub UserForm_Initialize() ls.propFlag = True End Sub ' code in csList Dim bFlag As Boolean Public Property Let propFlag(b As Boolean) bFlag = b End Property Public Property Get propFlag() As Boolean propFlag = bFlag End Property Public Function fncTest() As String fncTest = CStr(bFlag) End Function Run the form and click on it (first letter in "ls" is lower case L, not an upper i or number one, which I first suspected might be the problem) Regards, Peter T "=Ray=" wrote in message ... Hello, I have a class (csList) with several properties and methods and I need to have it "publicly" available within the routines of a userform. When I use "Public|Private ls As New csList" at the top of the userform code and reference the methods in any of the userform routines as "ls.method" it tells me Method or Data Member not found (Autocompletion doesn't recognize them either). I've also tried removing the New statement and using a "Set ls = New csList" line in the userform code, but the same thing happened. What am I doing wrong? Thanks, =Ray= |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform level class instance doesn't recognize methods
Thank you for your effort.
Silly me, all my class routines were private! (I taught myself VBA a few years ago, and I haven't done much with it since then, and I guess I've gotten rusty!) =Ray= "Peter T" wrote: Hi Ray, With the following everything works as expected, including the intellisense ' code userform1 Private ls As New csList Private Sub UserForm_Click() MsgBox ls.propFlag Me.Caption = ls.fncTest End Sub Private Sub UserForm_Initialize() ls.propFlag = True End Sub ' code in csList Dim bFlag As Boolean Public Property Let propFlag(b As Boolean) bFlag = b End Property Public Property Get propFlag() As Boolean propFlag = bFlag End Property Public Function fncTest() As String fncTest = CStr(bFlag) End Function Run the form and click on it (first letter in "ls" is lower case L, not an upper i or number one, which I first suspected might be the problem) Regards, Peter T "=Ray=" wrote in message ... Hello, I have a class (csList) with several properties and methods and I need to have it "publicly" available within the routines of a userform. When I use "Public|Private ls As New csList" at the top of the userform code and reference the methods in any of the userform routines as "ls.method" it tells me Method or Data Member not found (Autocompletion doesn't recognize them either). I've also tried removing the New statement and using a "Set ls = New csList" line in the userform code, but the same thing happened. What am I doing wrong? Thanks, =Ray= |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Generic Userform class | Excel Programming | |||
refedits in a userform control class | Excel Programming | |||
Userform doesn't recognize other user form upon re-load | Excel Programming | |||
Class Instance Identifier | Excel Programming | |||
"Static" Methods in Class Modules | Excel Programming |