XL: Recording a Visual Basic Macro in an External Module

Last reviewed: February 3, 1998
Article ID: Q108060
The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for the Macintosh, versions 5.0, 5.0a
  • Microsoft Excel for Windows 95, versions 7.0, 7.0a

SUMMARY

In the versions of Microsoft Excel listed at the beginning of this article, you can record a macro and save it in a different workbook than the workbook you are performing the steps in. To do this, follow the steps below to set the macro recorder to record in the other workbook:

  1. Select the Visual Basic module in the workbook where the macro should begin recording.

  2. On the Tools menu, point to Record Macro, and click Mark Position for Recording.

    NOTE: At this point you can return to the workbook in which you plan to perform the steps. To begin recording, point to Record Macro on the Tools menu, and click Record at Mark.

NOTE: This method does not record the Sub() and End Sub statements necessary to create a separate Sub procedure. This is by design. To create a separate Sub procedure, add the Sub() and End Sub statements to the recorded code manually.

NOTE: This method is not available in Microsoft Excel 97 for Windows or Microsoft Excel 98 Macintosh Edition. For more information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q157958
   TITLE     : XL97: No "Record at Mark" Feature in Microsoft Excel 97


Additional query words: 5.00 5.00a 5.00c 7.00 7.00a XL5 XL7
Keywords : kbprg PgmHowto kbprg
Version : WINDOWS:5.0,7.0; MACINTOSH:5.0
Platform : MACINTOSH WINDOWS
Issue type : kbhowto


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: February 3, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.