Executing code from within a macro?

Balr14

Registered User.
Local time
Today, 16:54
Joined
Oct 30, 2008
Messages
34
I'm not very good with macros, as you can probably guess. My import macro works fine, but I can't get it to run a VB sub very well. I tried an "Open Module" action in the macro, but it pops up the VB window so I can run the sub procedure manually. It works, but it's not too impressive to show the boss.

It seems to work if I turn the sub into a function in VB and specify run code in the macro action. Is this OK to do?
 
Last edited:
I'm not very good with macros, as you can probably guess. My import macro works fine, but I can't get it to run a VB sub very well. I tried an "Open Module" action in the macro, but it pops up the VB window so I can run the sub procedure manually. It works, but it's not too impressive to show the boss.

It seems to work if I turn the sub into a function in VB and specify run code in the macro action. Is this OK to do?

Yes, that is normal - :)
 
A macro can only call a PUBLIC Function in a module. You could however make a simpel function who in turn can call upon a PUBLIC sub.
 
A macro can only call a PUBLIC Function in a module. You could however make a simpel function who in turn can call upon a PUBLIC sub.

That seemed kind of odd to me.
 
You might put some code behind a button or stand alone label and part of that code is calling a function that is in a module, in the same way a macro does except when a function is called from code you dont have () after the function name.

Calling a function from within a function is the counterpart of the RunMacro action.
 

Users who are viewing this thread

Back
Top Bottom