Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling a macro from inside a macro

Status
Not open for further replies.

ericfr8

Technical User
Sep 9, 2005
2
US
Scottmh wrote in another thread:

"I found the only way to have a macro call/run another macro was to take the called/run macro and make it an *.ebh (Header) file. You'll need to change that macro's Sub Main/End to a Function, but it works very well.

Then the calling macro needs a '$Include: "extra!.ebh" in the very top of the macro. After that you just call/run the second macro by calling it by name."

Can you post the text of one of your macros that works, so I can adapt it? I want Extra to look at a field and then choose a macro to run based on its contents.

thanks
 
File Macro.ebm
Code:
'$Include: "C:\Macros\Macro1.ebh"
Sub Main
Macro1Sub
End Sub

File C:\Macro\Macro1.ebh
Code:
Sub Macro1Sub
MsgBox "Here's how you use a header file."
End Sub

The main reason to use header files is so that you can easiliy reuse subroutines and functions for more than on macro. But, you can use it to chain a macro as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top