Name of currently running macro...

J

John Keith

How would I reference the name of the currently running macro?

Either from the macro screen OR from a VB code module.

I have some functions stored in a code module that need the macro name as
the input parameter... I.E. PAStart("macro name") <-- I could hard-code/type
it in when ever I am setting up each macro that uses this, but it would be
much nicer if I could specifiy the function call ... PAStart(me.name) for
example.
-OR-
Perhaps from the RunCode action, reference the function with a null input
parameter and have the VB Code detect null input and then grab the currently
running macro name from some object (like ME.___ that is aviable when running
a form module)

Is something like this possible, or am I forced to hard-code the input parm
each time I have a macro call this function?
 
S

Steve Schapel

John,

If you are using Access 2007, you could include a SetTempVar action in
your macro, and then reference the TempVar in you code. That would work
well.

If you are using an old version of Access, the only thing I can think of
is to so,ething like this... put an unbound textbox or a label on a
form, and then use a SetValue action in the macro to write the name of
the macro to the value of the textbox or caption of the label, or for
that matter the Tag property of the form itself, and then your code can
read this back from the textbox or label or Tag. A bit of a hack, for
sure, but should do the trick I think.
 

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