'Tis me again, with what might possibly be a very simple question, but one I just don't know where to start searching. I will begin with an example that should make sense to everyone, then describe what I am trying to do.
First, a common example. Let us say we are working with an object. An object has properties, some of which can be changed, and it also has methods which do things. For example, a Form has the Property of BackColor, which can be changed do different colors. But Forms also have the Method of MoveSize, which does something: it moves the form or changes the visual dimensions of the form, using values for the Top, Left, Height and Width arguments for that method. In VBA it might look something like this:
Expand|Select|Wrap|Line Numbers
- Private Sub ChangeForm()
- With Me
- .BackColor = RGB(0, 0, 0)
- Call .MoveSize(Top:=0, _
- Left:=0, _
- Height:=1296, _
- Width:=1800)
- End With
- End Sub
Now, let's say, for example, that I have created a new class module that I have named Person:
Expand|Select|Wrap|Line Numbers
- Option Compare Database
- Option Explicit
- Public Name As String
- Public Height As Integer 'Height in Inches for US folks
- Public HairColor As String
Expand|Select|Wrap|Line Numbers
- Private Sub CreatePerson()
- Dim perBlank As New Person
- With perBlank
- .Name = "Hulk Hogan"
- .Height = 80
- .HairColor = "Blonde"
- End With
- End Sub
Expand|Select|Wrap|Line Numbers
- Private Sub DisplayPerson()
- Debug.Print perBlank.Name
- End Sub
Hulk Hogan
.So, finally, here is my question: Is there a way to add a Method to a Class, such that all I need to do is do this:
Expand|Select|Wrap|Line Numbers
- Call perBlank.Display
Again, this may have a super simple answer--I just haven't been able to find any answers out there.
Thanks for the hepp!