XL: Recording a Visual Basic Macro in an External Module

ID: Q108060

The information in this article applies to:

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

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

Last Reviewed: February 12, 1999