class functions

  • Thread starter Thread starter TheIrishThug
  • Start date Start date
T

TheIrishThug

i've programed classes in C++ where you can have functions that are
specific to the class and have access to all the variables in the
class.

how would i need to setup a Sub that would have access to these
variables?
i want something along the lines of

Code:
 
Hello TheIrishThug,

Unfortunately VBA is not a true object oriented language like C++. A
VBA object does not inherit all the properities from a particular class
when it is created. Programmers who use other OOLs that start to learn
VB or VBA often assume that a Class is a Class. A Class object in VB or
VBA is more like Java and nothing like a C or C++ class. I would suggest
you read up on VB classes to gain a better understanding of their
function and design. Wish I could be more help, but it isn't as simple
as your example.

Sincerely,
Leith Ross
 
Declare the variables as module level variables perhaps? That is, before any
procedure declarations within the module.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"TheIrishThug" <[email protected]>
wrote in message
news:[email protected]...
 
Declare the variables in the declarations section of the class
(before and outside of any procedure), and make you procedures
Public not Private. E.g.,


Private m_Draw(1 To Whatever) As Whatever

Public Sub DrawAddOne(ByVal a As Integer)
m_Draw(a) = m_Draw(a) + 1
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"TheIrishThug"
in message
news:[email protected]...
 

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

Back
Top