Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Aug 2013
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA: Subs and Functions: Navigating the IDE

    I notice two things about Subs and Functions that require an argument:

    1) They don't appear in the "Macro" dialog. (This is also true of all Functions, with or without arguments). I have to open a random module and use "Find" to locate it. Is there a listing somewhere that will show them all, so I can click and jump right to it?

    2) I can't step through the Sub or Function unless its been called by another procedure. I realize that if I could do it, it would cause an error when it tries to use a "null" argument, but often that's a minor problem. Is there a way to do this?

    Thanks.


    -- Shawn

  2. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Willow Grove, Pennsylvania, USA
    Posts
    197
    Thanks
    4
    Thanked 46 Times in 38 Posts
    1) No, there is no general list of all procedures. Using the Find dialog is as good a way as any. It may help to name modules in a logical way and to group Subs and Functions into modules according to what they do.

    2) No, there's no way to step into a function or a subroutine that has arguments without some caller that supplies the values of the arguments. If you tried it, you wouldn't get a null argument, you'd just get a runtime error (unless all the arguments are optional, but then they would always have default values). It's a good idea to write a Sub Test_XYZ() procedure at the same time that you write the Sub or Function, one that calls the Sub or Function with a variety of inputs. When you're about to distribute your work, simply comment out the Test routines -- you may want them back later.

Tags for this Thread

Posting Permissions

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