Hmmm, how odd. Must be to do with the way VB deals with ReDimmed arrays, ie maybe it doesn't actually increase the size of the original, it just creates a new one and points the old one to the new one or something...I don't know.
How about the following:
Private Type something3 'Length = 24 (no matter what redimmed to)
a As Long
b As Long
c() As Byte
d() As Byte
e As Long
f As Long
End Type
Dim Example1 as something3
This is 24 because we know that the four LONG variables are each 4 bytes and it must use one four byte space to hold the variable to be redimmed, thus 6 x 4 = 24.
Why not use this to find out the size:
arrlength = UBOUND(Example1.c) + UBOUND(Example1.d) + 16
Of course, this will fail if Example1.c and Example1.d have not been redimmed already, but if you ReDim them straight away, even just to 1, then this will overcome that.
EDIT:
Just checked to make sure I am right (I may not be)
Private Type something1
a As Long
End Type
dim Example1 as something1
lenb(example1) = 4 : I would expect this.
Private Type something1
a As Long
b As Long
End Type
dim Example1 as something1
lenb(example1) = 8 : I would expect this too.
Private Type something1
a As Long
b As Long
c(1) as Byte
End Type
dim example1 as something1
lenb(example1) = 12 : again, what I expected.
But:
Private Type something1
a As Long
b As Long
c(1) as Byte
d(1) as Byte
End Type
dim example1 as something1
lenb(example1) = 12 : this I was expecting to be 16!
Only when you add another variable (ie e(1) as Byte) does it move to 16, and then you can add another one (ie f(1) as byte) and it stays at 16!)
Oh dear, seems not to be as simple as I thought.
Tim