ReDim with variable array



According to the Help, I should be able to create an array of variable
length by declaring it like this:

MyArray() as String

However, when I try to assign anything to it:

MyArray(0) = "foo"

I get "subscript out of range".

Am I misunderstanding what the Help means by this? It seems to have gaps
just where you need specifics.

TIA;

Amy


.



Relevant Pages

  • Re: Working with floating point numbers.
    ... Some languages let you do this sort of thing by declaring two variables ... at the same address - e.g. a Double and an 8-byte array of Char. ... S As String * 4 ... Dim S As MyStrings ...
    (microsoft.public.access.modulesdaovba)
  • Re: Type Mismatch Error
    ... ' Read text file into an array #1 ... Dim InString As String, MyArray As Variant ... ' Debug.Print MyArray ' type mismatch error. ...
    (microsoft.public.vb.general.discussion)
  • Re: wchar_t as a string parameter
    ... Also, just to add, I am not a big fan of hard coding numbers as array sizes so I'd likely do something like: ... Then you can easily change the string size when you decide it's going to be larger. ... I agree totally on my bad form of declaring my string variable wchar_t ... MyFunction(szMyString); ...
    (microsoft.public.vc.mfc)
  • What is the correct way to pass an Array into a function
    ... Could somebody please help me figure out how to pass an array into a ... I can't figure out how to declare myArray(), ... Public Function fnDisplayMSGAs String) As ...
    (microsoft.public.scripting.vbscript)
  • Re: alternative php syntax
    ... I am building an array of strings in the form of "number=", ... I literally mean to assign string values such as: ... know php is loose about declaring variables. ...
    (alt.php)