Testing of procedures

G

GeorgeMar

Why is it that you can't always Run a procedure from the
VB Editor to test it? It comes up with macro window and
the procedure that you want is not listed.

sometimes when you place the cursor in the procedure and
hit Run, it works, other times it doesn't. Is there a way
to always make it Run?

regards
george
 
A

Allen Browne

A simple way to test a procedure is to open the Immediate Window (press
Ctrl+G).
Then call your function like this:
? MyFunc()
or your sub by just typing its name:
MySub

That will not work if the procedure has the word "Private" before its
declaration.

If the procedure is from a class module (such as the module of a form), you
may need to include the module name to reference the procedure, e.g.:
Form_MyForm.MyButton_Click
You see the name of the module in the title bar of the code window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top