Class Modules

I

ibeetb

Can you create a Class Module using VBA without using the Property Lets and
Gets???
Can you instead just Publicly declare the Class Module?
If so....does anyone have a full example from the creation of the class
module through creation of the code for the Regular code module???
I would appreciate it

Than k you
 
B

Bob Phillips

Lets and Gets and just the write/read specific properties. If you just
declare a public variable, that effectively becomes a read/write property.
In summary, yes you can.

Here's a very simple Class

Public myVar

Public Function myMethod() As Long
myMethod = myVar * 5
End Function


and this is the class invoked in a normal module

Sub test()
Dim myClass As Class1

Set myClass = New Class1
With myClass
.myVar = 17
MsgBox .myMethod()
End With

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top