XL: Calling a Microsoft Excel Macro from a Lotus 1-2-3 Macro

ID: Q119882

The information in this article applies to:

SUMMARY

A macro written for Lotus 1-2-3 may be modified to run a Microsoft Excel macro in order to perform specific functions. In order to use the existing Lotus 1-2-3 macro and incorporate the Microsoft Excel macro, modify the Lotus 1-2-3 macro to include the Lotus 1-2-3 macro command XLCALL or XLBRANCH.

MORE INFORMATION

Two Lotus 1-2-3 macro commands, XLCALL and XLBRANCH allow the you to run a Microsoft Excel macro from a Lotus 1-2-3 macro. The format of the commands are {XLCALL xl_macro_name} or {XLBRANCH xl_macro_name}. The XLCALL command will call the macro (xl_macro_name); then return control to the Lotus 1-2-3 macro that called it. The XLBRANCH command will call the macro (xl_macro_name) but will not return control to the originating macro.

NOTE: In Microsoft Excel 97, the syntax to run a Microsoft Excel macro is {XLCALL ThisWorkbook.macroname}.

The {XLCALL} and {XLBRANCH} commands are not available to versions of Microsoft Excel earlier than version 4.0 because these products did not use the Microsoft Excel macro interpreter.

For example, if you created a macro named PagePrint to set your headers and footers on a macro sheet named PRINT.XLM and you want to call the macro from within one of your 1-2-3 macros, you can do this by inserting the command {XLCALL PRINT.XLM!PagePrint} within your 1-2-3 macro. Using a Visual Basic, Applications Edition, macro, the 1-2-3 macro would be written {XLCALL module1.PagePrint}. As with any subroutine, after the Microsoft Excel macro runs, control of the macro returns to the 1-2-3 macro. With XLBRANCH, you branch to Microsoft Excel and do not return to the 1-2-3 macro.

NOTE: A Lotus 1-2-3 macro cannot be run from a Microsoft Excel macro.

The third-party products discussed here are manufactured by vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding these products' performance or reliability.

REFERENCES

"Microsoft Excel Users Guide", version 5.0, page 38 "Switching to Microsoft Excel from Lotus 1-2-3," version 5.0, page 34

Additional query words: XL97 97 7.00 4.00 4.00a 5.00 xl5

Keywords          : xlvbainfo xl123Quattro 
Version           : WINDOWS:4.0,4.0a,5.0,5.0c,7.0,97
Platform          : WINDOWS

Last Reviewed: January 8, 1999