tags:

views:

88

answers:

1

Looking to create an inline array in Visual Basic for Applications

Something like this would be cool

Dim a() as Integer
set a = {1,2,3} 

In Java, this would be the equivilant functionality

int a[] = {1,2,3};

Also, bonus points if you can tell me how to find its length afterwards (without needing to hard code it, as all the examples my Googling have uncovered)

(please don't tell me to Google it. I normally don't use vb, and I'm discovering that every result for a vb question on Google is answered terribly. ex, hard coding values)

+3  A: 
Dim a() As Variant
Dim Length As Integer

a = Array(1,2,3)

Length = UBound(a,1) - LBound(a,1) + 1
Lance Roberts