• VBA: Subs and Functions: Navigating the IDE

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » VBA: Subs and Functions: Navigating the IDE

    Author
    Topic
    #491951

    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

    Viewing 0 reply threads
    Author
    Replies
    • #1422630

      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.

    Viewing 0 reply threads
    Reply To: VBA: Subs and Functions: Navigating the IDE

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: