cgdrake
06-18-2008, 05:07 AM
How do you run a VBA module from a macro? I tried the OpenModule action, but all it did was to open the module. I had thought this would run it since OpenQuery runs the query, not just opens it. Any help would be appreciated.
ctechnumber1
06-20-2008, 12:06 PM
Create a Function in VBA consoleL:
Public Function()
.....
End Function
Then go to macro and enter "RunCode"
then browse to the function
let me know how it goes
Mike375
06-20-2008, 01:50 PM
Select RunCode for the macro action.
At the bottom of the macro design screen enter function name as
functionname()
Make sure you enter the function name, not the name of the module.
Attached is an example
cgdrake
06-21-2008, 06:20 AM
Does it make a difference if my code is a procedure rather than a function? Thanks for the code.
boblarson
06-21-2008, 12:09 PM
Does it make a difference if my code is a procedure rather than a function? Thanks for the code.
It has to be a public function and not a sub for it to show up in the list. Just change it from a sub to a function. (and by the way a function is a procedure too, just not a sub procedure.
cgdrake
06-21-2008, 01:25 PM
OK, thanks, I'll try that.