UDT collections
UDT collections
(OP)
It seems that a User defined type in VBA does not have a collections property. Is this correct? And if so, what is a good workaround for accessing the .count of a UDT array.
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting Guidelines |
|
Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.
Here's Why Members Love Eng-Tips Forums:
Register now while it's still free!
Already a member? Close this window and log in.
RE: UDT collections
This link might be useful:
http://www
Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/
RE: UDT collections
CODE
x As Double
y As Double
End Type
Sub testtype()
Dim myvar() As mytype
ReDim myvar(3 To 9)
Debug.Print "Size of myvar is " & UBound(myvar) - LBound(myvar) + 1
End Sub
For multidimensional array lbound and ubound can take a 2nd argument to identify which index is being tested.
=====================================
(2B)+(2B)' ?
RE: UDT collections
I'll try IDS's suggestion, read up on it and figure out which will be the most convenient.
Thanks to both of you.
RE: UDT collections
RE: UDT collections
I think my original response was misleading. I was thinking of making a collection of instances of the Type, then that would have a .count property, but if you want a .count of the attributes of the Type itself, I don't know, and a search didn't find anything useful. If I come across anything I'll let you know.
Doug Jenkins
Interactive Design Services
http://newtonexcelbach.wordpress.com/
RE: UDT collections
Type FlowElement
Diameter as ..
Wall_Thickness as ..
Yield_Strength as ..
End Type
Then figure out I need to add FromNode, ToNode, Length, or CV coefficient or something, so I can do some newly thought out calculations I just discovered I need. Really easy to just add them into the definition, define what they are in the sub and automatically keep each attribute indexed to its corresponding item in the FlowElement "array".
No. The article you gave me was good. I never heard about the Dictionary thing before either!
Cheers^2
RE: UDT collections
One concept is array vs collection. Collection has count property, array does not.
Another concept is is user defined data type vs other data types. It is entirely different distinction. Either type could be used in array or collection. The fact that an array doesn't' have a count property has nothing to do the fact that it is a user-defined data type. Arrays of double, Booleans etc also have no count property.
Maybe this is already understood by all... I'm not sure. If it is understood, then please feel free to ignore my comments.
=====================================
(2B)+(2B)' ?