View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Emulate C/C++ struct in VBA?

In VBA, structures are created with the Type statement. E.g.,


Type TheType
X As Long
Y As Long
Z As Long
End Type

Note that Types must be declared outside of any procedures, but
variables of that type may be declared within procedures:

Sub AAA()
Dim T As TheType
' more code
End Sub


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




wrote in message
...
I was wondering if there is a way to emulate a struct?

I have a series of statistics I am collecting from a
spreadsheet and I would like one container for a number of
different data types to hold those statistics (top 5 most
used tests, most expensive test, etc.).

Do I have to implement a whole VBA class do be able to do
this?

If I do, can someone point me to a tutorial on
implementing VBA classes as I've only been using VBA for
perhaps two weeks.

Thanks