View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default 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=