I am unable to work out the use of class modules as they seemed to be private by default and I am unable to call any procedures in a class module from a form or another module.
So what's the use of a class module?
I am unable to work out the use of class modules as they seemed to be private by default and I am unable to call any procedures in a class module from a form or another module.
So what's the use of a class module?
You simply declare any routines that should be public as Public.
Be as you wish to seem
Thanks for your reply.
The procedures are declared public. No Luck!
For an example how to use a class module have a look over here:
http://www.snb-vba.eu/VBA_Userform_i...ntrole_en.html
Thanks, snb. It will take some time to digest, but like the link you provided about my post regarding renaming modules, this information open new doors.
My guess would be that you weren't creating an instance of the class when trying to call its methods?
Be as you wish to seem
A Class Module is a blueprint of a custom Object. Once you have defined the custom object, you have to create, (Instantiate,) the object with the New keyword, just like creating a new Collection. Then you can use any custom methods, Properties, and Events just like with any other Object.
[vba]Dim X As New Collection
With X
.Add(Item, Key)
,Add(Item,Key)
End With
Z = X.Count[/vba] [vba]Dim Y As New c_MyClass
With Y
.CustomMethod(Parameters) 'Private Sub
End With
Z = Y.CustomProperty 'Property Get Sub[/vba]
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
I used custom classes in dBase, quite different from this. I appreciate all the replies and assistance. It opens new doors that I will certainly explore and would put to good use.