Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Aug 2002
    Location
    Oklahoma City, Oklahoma, USA
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Does Word VB Look Ahead? (2000 (SR-1a))

    I have the following at the very end of an AutoOpen macro.

    Sub FileSaveAs()
    End Sub
    Sub FileSave()
    End Sub

    If I Ctrl-Break and stop execution long before the macro ever gets to those statements, file_save and file_save_as are still disabled.

    Does Word VB make a first pass through so it knows what subs there are and then go back and execute?

    The only other possible explanation I can think of is that everytime a regular command is executed VB checks to see if it has been pre-empted by a sub of the same name. That seems sort of wasteful.

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Does Word VB Look Ahead? (2000 (SR-1a))

    Yes VBA knows the Scope of Subs and whether they are public.

  3. #3
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Does Word VB Look Ahead? (2000 (SR-1a))

    Your FileSave and FileSaveAs are not part of your AutoOpen macro, they are completely separate macros.

    When the project is opened, Word has to know all the macros and where they start so that it can call them.
    I suspect that it makes a pass through the code when it is compiled to build this table, but I guess it could be when the document is opened.

    StuartR

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Does Word VB Look Ahead? (2000 (SR-1a))

    I suspect that VBA builds internal lists, etc. before you compile, so intellisense can work.

Posting Permissions

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