Fix Excel Macro Not Working with AutoSave Before Manual Save
Question details
A VBA macro designed to save a worksheet as a PDF and attach it to an email fails to run when opened without a manual save, despite AutoSave being enabled.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Attempting to execute a VBA macro relying on the file's saved state while AutoSave is active.
- Observed behavior
- The macro fails to complete its tasks under AutoSave but functions correctly immediately after the user performs a manual save.
Ensure you are running the Microsoft Excel desktop application, as VBA macros are not supported in Excel for the Web and will not run in a browser.
Verify Application Environment and Open in Desktop App
Confirm that the workbook is not being opened in Excel for the Web, which blocks VBA macro execution.
Many AutoSave issues tied to macros occur because files stored in OneDrive or SharePoint automatically open in the web browser by default. Excel for the Web cannot execute VBA code.
Look at your application window. If you see a web browser interface (like Chrome or Edge), your workbook is open in Excel for the Web.
Click the 'Editing' or 'Viewing' button located on the top ribbon of Excel for the Web.
Select 'Open in Desktop App' from the dropdown menu to launch the full Excel client on your computer.
Wait for the file to load, ensure AutoSave is toggled on in the top left corner, and attempt to run your PDF and email macro again.

Isolate the Issue with a Test Macro
Create a brand new macro-enabled workbook to determine if the AutoSave conflict is specific to your original file or a wider Office environment issue.
Try WPS Office for Reliable Spreadsheet Management
If Microsoft Excel's AutoSave feature continues to interfere with your VBA workflows, consider switching to WPS Office. It provides strong compatibility with Microsoft Excel formats and offers a lightweight, intuitive environment for all your daily spreadsheet tasks.
- 1. Download WPS Office: Visit the official WPS website and download the free version of WPS Office.
- 2. Open your workbook: Launch WPS Spreadsheets and open your existing .xlsm or .xlsx file.
- 3. Manage your data: Enjoy seamless spreadsheet editing, formula calculation, and document formatting in a stable environment.

Frequently Asked Questions
Why does my macro only work after a manual save?
When AutoSave is active, Excel constantly syncs changes to the cloud. Some VBA operations, like generating a PDF from the active sheet or fetching specific local file paths, might fail if the file is in a temporary syncing state. A manual save forces a local commit, stabilizing the file state for the script to run.
Can I run macro-enabled workbooks in a browser?
No, macro-enabled workbooks (.xlsm) cannot execute VBA scripts in Excel for the Web. While you can view the data online, you must open the file in the desktop version of Excel to run any embedded macros.
How do I share my macro code for further troubleshooting?
Open the VBA Editor by pressing Alt + F11, locate your module in the Project Explorer, copy the code text, and paste it into your support forum request. Be sure to also include your exact Excel version number and account type (e.g., Microsoft 365 Family or Enterprise).




