How to save Excel file contains VBA Macros code

In order to reuse the VBA Macros code in Excel, users can save the Excel file.

When using advanced Excel, not only complex Excel functions, but also add ins, or Excel code VBA Macros are used by a lot of people, especially VBA Macros. With the VBA Macros code, users can set repetitive actions from simple to complex that we do not need to manipulate from the beginning.

However, when you save the Excel file using the VBA Macros code in the usual way, the VBA Macros will only be used in one calculation and set the value only, cannot be reused if the user has needs apply to other files. The code used in the file automatically disappears when you save the file as usual. So, does backing up Excel files contain VBA Macros code so they work again when opening the file? The following article of Network Administrator will guide you how to do it.

  1. How to break VBA password in Excel
  2. MS Excel 2003 - Lesson 8: Excel Macro - Automate complex tasks
  3. How to send email from Excel spreadsheet with VBA script
  4. How to install VBA in Excel

Instructions for saving Excel file VBA Macros

Step 1:

Take, for example, a flash text editor on Excel that uses VBA code.

How to save Excel file contains VBA Macros code Picture 1How to save Excel file contains VBA Macros code Picture 1

If the user saves the Excel file that contains the VBA code in the usual way with the default format * .xlsx, the following message will be displayed. The content of this message can be understood if you save this file, you cannot save the contents in Macro Excel. If you press Yes to save, the Macro code will be deleted. If you press No, cancel the save command.

How to save Excel file contains VBA Macros code Picture 2How to save Excel file contains VBA Macros code Picture 2

At the interface of the file, click the Office icon and select Save As .

How to save Excel file contains VBA Macros code Picture 3How to save Excel file contains VBA Macros code Picture 3

Step 2:

Switch to the folder view, choose where to save the file and then in the Type Save section select Excel Macros-Enabled Workbook from the list but not the Excel Worbook format as default. Click Save to save the Excel file with Macros.

How to save Excel file contains VBA Macros code Picture 4How to save Excel file contains VBA Macros code Picture 4

If you receive the message as shown below, press Ok to continue.

How to save Excel file contains VBA Macros code Picture 5How to save Excel file contains VBA Macros code Picture 5

Step 3:

Open the folder to save Excel file will see 2 files with the same name but different.The file contains VBA Macros with an exclamation icon as shown.

How to save Excel file contains VBA Macros code Picture 6How to save Excel file contains VBA Macros code Picture 6

The format of the file containing VBA Macros is * .xlms and the original Excel file is in * .xlsx format.

How to save Excel file contains VBA Macros code Picture 7How to save Excel file contains VBA Macros code Picture 7

Step 4:

Now open the file containing the VBA Macros, if the content has VBA Macros code that is not available and has the following interface, click Options .

How to save Excel file contains VBA Macros code Picture 8How to save Excel file contains VBA Macros code Picture 8

Click on Enable this content to display the content containing the Macros VBA code on the Excel document, then click Ok below.

How to save Excel file contains VBA Macros code Picture 9How to save Excel file contains VBA Macros code Picture 9

The result of using Macros VBA code on Excel has been displayed again.

How to save Excel file contains VBA Macros code Picture 10How to save Excel file contains VBA Macros code Picture 10

The operation to save Excel files containing VBA code Macros will be different when you save the Excel file normally. The default format for saving Excel files is * .xlsx and * .xls, and the format when saving an Excel file contains a VBA code for * .xlsm or xlsb with an exclamation mark next to the Excel file icon for easy identification. . When you reopen the file, users can still use VBA, edit the values ​​if desired.

I wish you all success!

3.8 ★ | 17 Vote