Running a VBA Module from a Macro

cgdrake

Registered User.
Local time
Today, 13:57
Joined
Jul 22, 2007
Messages
38
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.
 
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
 
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
 

Attachments

Does it make a difference if my code is a procedure rather than a function? Thanks for the code.
 
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.
 

Users who are viewing this thread

Back
Top Bottom