Microsoft KB Archive/119882

= Calling a Microsoft Excel Macro from a Lotus 1-2-3 Macro =

Article ID: 119882

Article Last Modified on 8/15/2005

-

APPLIES TO


 * Microsoft Excel 4.0 Standard Edition
 * Microsoft Excel 4.0a
 * Microsoft Excel 5.0 Standard Edition
 * Microsoft Excel 5.0c
 * Microsoft Excel 95 Standard Edition
 * Microsoft Excel 97 Standard Edition

-



This article was previously published under Q119882



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.

