Macro Problem

M

mike

I am trying to create a macro that has parameters and i cannot get it to
work. I create a macro name test.fill and it then creates the module name
test with a sub called fill. I then go into VBA editor and add parameters
to this sub and it makes the macro disappear. Why is this?

Thanks
 
J

Jay Freedman

Hi Mike,

The macro is still there -- that is, its code is there, and you can
call it from another macro -- it just disappears from the list in the
Macros dialog. The reason is that MS decreed that only Public Sub
procedures with no arguments will appear in that list. There's no way
from that dialog to pass any arguments to the macro, so what would be
the point of listing it?

There are other ways for macros to get external information without
using arguments. They can examine the contents of the Selection
object, document variables or document properties, registry entries,
external files, or the results of userforms or InputBoxes. If you want
to assign toolbar buttons to run the macro, those buttons can have
values assigned to their Tag property and the macro can look at that.
 
M

mike

Thanks for the info. I am trying to call that public sub procedure outside
of word in VB and before this sub procedure had parameters I called the
macro.

wordApp.Run macroName

Is there a way I can access this procedure outside of word?

Thanks
 

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