We help IT Professionals succeed at work.
Get Started

Class Initialise VBA

Last Modified: 2013-12-26
Hi, can I pass parameters to the class Initialise method.


Private Sub Class_Initialize()

End Sub

Can take parameters like this:

Private Sub Class_Initialize(name As String)

End Sub

This the leads me to believe that I can then write code like this:

Dim cPerson as New Person("Peter")

But I do not seem to be able to pass a value to the class initialiser....Since the initialiser takes parameters, can somebody tell me how to pass values to them?  I was hoping to be able to pass them at initialisation.   Thanks.
Watch Question
Expert of the Quarter 2010
Expert of the Year 2010
This problem has been solved!
Unlock 2 Answers and 4 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE