Are arrays in VBA stale, or I'm wrong?

Giganews Newsgroups
Subject: Are arrays in VBA stale, or I'm wrong?
Posted by:  martin-g (martin…@mail.ru)
Date: 18 Aug 2006

Hi.

I have a question on arrays in VBA. I'm a C++/C# programmer and didn't
expected arrays in VBA to be so helpless, or maybe it only seems to me
that they are helpless.

For example in C++ we can easily create a dynamic array using
stl::vector, add elements at every position, remove elements at every
position and it will automatically organize memory for us. How can such
things be done in VBA?

Here is an example:

vector<int> v; // Create a vector
for (int i = 1; i <= 10; ++i)
    v.push_back(i);  // Add the value of 'i' at the end of the vector

v.erase(v.begin()+4); // Remove the 5-th element from the vector

etc, etc...

So, how can these be realized in VBA? Especially how to remove an item
from the middle of the array?

Thanks in advance

Martin

Replies