logo
search
VBA & Macro Problems

How to Save Excel Files with Macros and UTF-8 Text

Bushra ParveenBushra Parveen Oct 23, 2026 868 views

Question details

The user needs to save an Excel file containing both VBA macros and UTF-8 encoded text (like Hebrew) without losing either the script or the character encoding.

Which Excel File Format Supports Macros and UTF-8 Text?
Product
Microsoft Excel
Device & OS
not provided
Scenario
Trying to save an Excel workbook that contains both automated VBA code and foreign language text that requires UTF-8 encoding.
Observed behavior
Saving the file as a CSV drops all VBA macros because it is plain text, and saving it as an XLSX drops macros due to security format restrictions, making it difficult to preserve both simultaneously in a single standard format.
Before you start

Ensure that your VBA macros are fully written and compiled, and verify that any foreign language text displays correctly in your active worksheet before saving.

Solution 1Recommended

Save as XLSM and Export a Separate UTF-8 CSV

To maintain both your VBA macros and UTF-8 text, you must use a dual-file approach: keep a master macro-enabled workbook and export plain-text data as needed.

A single file format cannot satisfy both needs if you intend to use CSV. CSV is strictly a plain-text format and cannot store VBA code. Conversely, standard Excel macro formats are binary or XML-based. The best practice is to separate your database/macro storage from your text data export.

1
Save the Master Macro Workbook

Go to 'File' > 'Save As'. In the file format dropdown, choose 'Excel Macro-Enabled Workbook (*.xlsm)' or 'Excel Binary Workbook (*.xlsb)'. This safely stores your VBA code alongside your data.

2
Export the UTF-8 CSV Data

When you need to share or upload the text data (such as Hebrew), navigate to 'File' > 'Save As' or 'Export'. Select 'CSV UTF-8 (Comma delimited) (*.csv)' as the format.

3
Acknowledge the Format Warnings

Excel will prompt a warning that saving as CSV does not support multiple sheets or macros. Accept this to generate the text export, then close the CSV and continue working primarily in your XLSM file.

Save as XLSM and Export a Separate UTF-8 CSV
File Format Limitations: Never use the CSV file as your primary working document if you need macros. Always retain the XLSM file to run scripts and format your sheets.
Advanced Spreadsheet Features

Easily Manage Macros and UTF-8 Data with WPS Office

WPS Spreadsheet provides robust support for saving macro-enabled workbooks (XLSM) and exporting UTF-8 CSV files, ensuring your VBA scripts and international text are perfectly preserved without compatibility issues.

  1. 1. Open WPS Spreadsheet: Launch WPS Office and open your workbook containing macros and UTF-8 text.
  2. 2. Save as XLSM: Click the 'Menu' button, select 'Save As', and choose 'Microsoft Excel Macro-Enabled Workbook (*.xlsm)' to secure your VBA code.
  3. 3. Export UTF-8 CSV: To export your text data, go back to 'Menu' > 'Save As', select 'CSV (Comma delimited) (*.csv)', and ensure your encoding is set to UTF-8 in the prompt.
Fully compatible with Microsoft Excel file formats including XLSM, XLSB, and XLSXSeamlessly export text to CSV UTF-8 to preserve non-Latin charactersIntuitive Save As dialog to easily manage multiple file formatsLightweight, fast, and completely free to download
microsoft office alternative - wps office

Frequently Asked Questions

Why does my CSV file lose macros when saved in Excel?

CSV stands for Comma Separated Values. It is a plain-text format designed solely for tabular data separation. It physically lacks the structural capacity to store VBA code, formatting, or formulas.

Can standard XLSX files store VBA macros?

No. The standard XLSX format was designed by Microsoft to be macro-free for security reasons, preventing malicious code from running silently. To save macros, you must intentionally use the XLSM (Macro-Enabled) or XLSB (Binary) formats.

How do I ensure Hebrew or non-Latin text doesn't turn into question marks in a CSV?

When saving as a CSV, you must select the 'CSV UTF-8 (Comma delimited)' option in the Save As dialog instead of the standard CSV option. This guarantees special characters are encoded correctly and not lost.