Office for Mac Issues

How to Fix Microsoft Visual Basic Out of Memory Error in Excel for Mac

Maira MehtabMaira Mehtab Nov 2, 2026 871 views

Question details

Users encounter an out-of-memory error related to Microsoft Visual Basic when trying to run macros or open the VBA editor in Excel for Mac.

How to Fix Microsoft Visual Basic Out-of-Memory Error in Excel for Mac
Product
Excel for Mac
Device & OS
macOS
Scenario
Opening the VBA editor or executing macro scripts within an Excel workbook.
Observed behavior
Excel displays a 'Microsoft Visual Basic out of memory' error message, preventing the user from editing or running their VBA code.
Before you start

Ensure you have saved all open workbooks and completely quit all running Microsoft Office applications on your Mac before proceeding with the cache removal steps.

Solution 1Recommended

Clear the Excel Application Container Cache

Removing potentially corrupted preference and cache files is the most effective way to resolve sudden Visual Basic memory errors on macOS.

macOS stores application caches and settings in a dedicated container folder. If these files become damaged, they can cause Excel's VBA editor to misallocate memory. Resetting this container forces Excel to generate clean, functioning preference files without deleting your personal spreadsheets.

1
Quit all Office applications

Make sure Microsoft Excel, Word, and PowerPoint are completely closed. You can do this by right-clicking their icons in the Dock and selecting 'Quit'.

2
Open the Library folder

Click anywhere on your desktop to activate Finder. Press Command+Shift+G on your keyboard to open the 'Go to Folder' window, type '~/Library/Containers', and press Return.

3
Locate and move the Excel container

In the Containers folder, find the folder named 'com.microsoft.Excel' (or 'Microsoft Excel' on newer macOS versions). Drag this folder to your Desktop to keep it as a temporary backup.

4
Restart your Mac and relaunch Excel

Restart your Mac. Once rebooted, open Excel and try accessing the VBA editor again to see if the out-of-memory error is resolved.

Clear the Excel Application Container Cache
Data Safety: Moving the container folder to the Desktop does not delete your saved workbooks. It only resets your app preferences.
Free Microsoft Office alternative

Experience a Faster, Lighter Spreadsheet Solution with WPS Office

Tired of encountering memory errors and slow performance in Excel for Mac? Switch to WPS Office. It provides robust spreadsheet capabilities, seamless compatibility with Microsoft Excel formats, and a highly efficient environment that runs smoothly without draining your Mac's system resources.

  1. 1. Download and Install WPS Office: Get the free WPS Office suite for your Mac from the official website and complete the quick installation process.
  2. 2. Open your Spreadsheet: Launch WPS Spreadsheets and directly open your existing .xlsx or .xlsm files without any conversion.
  3. 3. Enjoy Stable Performance: Experience faster load times and smoother macro executions thanks to improved memory management.
Fully compatible with Microsoft Excel formats (.xls, .xlsx) and macro-enabled workbooks (.xlsm).Lightweight architecture that consumes significantly less RAM and CPU, preventing out-of-memory errors.Familiar ribbon user interface ensuring zero learning curve for Excel users.Built-in advanced data analysis tools completely free to use.
microsoft office alternative - wps office

Frequently Asked Questions

Why does Microsoft Visual Basic run out of memory on my Mac?

This typically happens due to a corrupted Excel preference/cache file on your macOS, outdated Office software, or inefficient macro code that fails to release object variables and causes memory leaks.

Will deleting the 'com.microsoft.Excel' folder delete my saved spreadsheets?

No. Removing or moving the Excel container folder to the Desktop only resets the application's preferences and cache files. Your saved workbooks and personal data remain completely safe and untouched.

How can I check my Mac's memory usage while running a macro?

You can open the 'Activity Monitor' app on your Mac (located in Applications > Utilities) and navigate to the 'Memory' tab. This will show you exactly how much RAM Excel is consuming while your VBA macro runs.

Can I run my Excel VBA macros in WPS Office?

Yes, WPS Office supports VBA macros. You can open your .xlsm files directly in WPS Spreadsheets and run your existing scripts. Because WPS Office is highly optimized, users often experience better memory management.