View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Array declared with the Static keyword clears itself between c

VBA code is not compied code. So it doesn't assign a varaible until it is
used. You may get the results you want by moving the declaration from
function to the Sub. When you compile code the Linker takes all the Static
variables and puts them into global memory and then checks all the functtions
and subroutines that use the variables to see which one are global and which
are loc. VBA doesn't do all the checking.

" wrote:

Thank you for your reply, Joel.

However, I am already aware that I could handle this with a module
level or global variable.
And I don't really understand what you mean with "Static only works
when you use a complier".
I have declared the bBeenHere variable as Static and it retains its
value between calls, just as it should.
So what is the reason why the asSplit() array doesn't remember its
contents? Is this behavious documented?