PDA

View Full Version : dynamic allocation/global variables



j_r_auden
4th Feb 2005, 03:45 pm
2 quick questions

1. How do I dynamically allocate space for an array. I do not know the size of the array until after runtime so I do not know how much space to allocate for the array.

2. I have an application that consists of several modules and I need one global variable to be a counter. Where do I need to declare this variable?? I am aware that in languages such as Java and C++, you have a main program and you can call other functions defined in header files. Can you do this in VBA. If so, how ???

Thanks,
James

hendie
4th Feb 2005, 04:23 pm
to dynamically allocate space for an array, you have to use the REDIM statement
to have a global variable, declare it at module level and make it Public