Results 1 to 2 of 2
2013-11-13, 15:13 #1
- Join Date
- Aug 2013
- 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?
2013-11-13, 15:33 #2
- Join Date
- Feb 2001
- Willow Grove, Pennsylvania, USA
- Thanked 49 Times in 40 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.