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

Last reviewed: December 17, 1996
Article ID: Q119882
The information in this article applies to:
  • Microsoft Excel for Windows, versions 4.0, 4.0a, 5.0, 5.0c
  • Microsoft Excel for Windows 95, version 7.0
  • Microsoft Excel 97 for Windows

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.

Lotus and 1-2-3 are registered trademarks of Lotus Development Corporation.

REFERENCES

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


KBCategory: kbprg kb3rdparty
KBSubcategory: xl123Quattro xlvbainfo
Additional reference words: XL97 97 7.00 4.00 4.00a 5.00 xl5



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: December 17, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.