Results 1 to 12 of 12

Thread: Scope and visibility in vba

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2010
    Location
    Bristol
    Posts
    36

    Scope and visibility in vba

    I am having trouble with a Sub not seeing arrays which are in the Declarations section of the same module. I have used Dim to specify these arrays and I understand that this makes them Private as a default BUT they should still be seen by the Subs in that Module. The strange thing is that several other Subs see the arrays OK. I judge that they are (or are not) seen by whether, if I deliberately spell them wrongly the vba corrects the spelling. Another way I check is to right click on the arrays and choose Definition. Sometimes this highlights the array in declarations and sometimes not. Is it possible that I have too many arrays - if so should there not be a warning? I did notice that replacing the arrays which were originally in one line by individual Dims. seemed to ease the situation but not cure it. I did try replacing Dim by Public but this made no difference. I cannot seem to find the limitations of vba; ie total no. of arrays, total cumulative size of arrays, etc. by clicking on help.
    I have found a "work around" but I am very uncomfortable having a problem that I don't understand. Although I have produced a very cut-down .bas file, I haven't got a clue how to put it on here! I assume that a .bas file does not go against the rules? I would be very grateful for any help you can give.
    Last edited by maurice_whittaker; Oct 29th, 2010 at 10:33 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width