VBA & Macro Problems

Fix Excel Macro Recorder Not Capturing Window Size or Position

Muhammad TalhaMuhammad Talha Oct 23, 2026 871 views

Question details

The user needs to record a macro that sets the specific dimensions, screen position, or maximized state of the Excel application window, but the macro recorder does not capture these actions.

How to Fix Excel Macro Recorder Not Recording Window Size or Position
Product
Microsoft Excel
Device & OS
Mac
Scenario
Recording a macro that includes moving or resizing the Excel application window.
Observed behavior
The macro recorder entirely ignores changes made to the window's size, position, and maximized state, resulting in a VBA script that lacks the required window manipulation commands.
Before you start

Ensure that the Developer tab is enabled in your Excel ribbon, as you will need to open the Visual Basic Editor (VBE) to manually insert the missing window sizing properties.

Solution 1Recommended

Manually Set Window Size and Position Using VBA Code

Because the macro recorder natively omits window sizing actions, you must edit the generated macro and manually define the application's properties.

The macro recorders in both modern Mac and Windows versions of Excel are primarily designed to capture cell data and formatting changes. They frequently fail to reliably capture application-level window changes. To successfully dictate where and how the window appears, you must write the size and position commands directly into your VBA script.

1
Open the Visual Basic Editor

Press Option + F11 (on Mac) or Alt + F11 (on Windows) to open the VBA Editor, or click the 'Visual Basic' button located on the Developer tab in the ribbon.

2
Locate your recorded macro

In the left-hand Project Explorer pane, expand the 'Modules' folder and double-click the module containing the macro you just recorded.

3
Define the window position

Inside your macro sub-routine, insert 'Application.Top = 10' and 'Application.Left = 10' to explicitly set the starting position of the application window from the top-left corner of your screen.

4
Define the window dimensions

Add 'Application.Width = 800' and 'Application.Height = 600' below the position commands to set the exact size of your Excel window in points.

5
Maximize the window (Alternative)

If your goal is simply to have the window fill the screen rather than setting specific dimensions, use the command 'Application.WindowState = xlMaximized' instead.

Manually Set Window Size and Position Using VBA Code
Application vs. ActiveWindow: Use 'Application' properties if you want to resize the entire Excel program window. Use 'ActiveWindow' properties if you only want to resize the internal workbook view within the Excel workspace.
Free Microsoft Office alternative

Try WPS Office for Your Spreadsheet Needs

If you are frustrated by the limitations of the Excel macro recorder or dealing with inconsistencies between Mac and Windows versions, consider using WPS Office. It offers a highly compatible spreadsheet environment that handles complex data effortlessly without the heavy subscription costs.

  1. 1. Download and Install: Visit the official WPS website and download the free WPS Office suite for your Mac or Windows computer.
  2. 2. Open Your Workbooks: Launch WPS Spreadsheets and easily open your existing .xlsx or .xlsm files without losing data or formatting.
  3. 3. Utilize Familiar Tools: Navigate the intuitive interface to access all your formatting, data analysis, and charting tools exactly where you expect them to be.
Seamless compatibility with standard Microsoft Office formats, including .xlsx and .xlsm files.Free and lightweight alternative to heavy Microsoft 365 subscriptions.Familiar ribbon interface ensures a zero-learning-curve transition for all users.Robust spreadsheet functions and tools for everyday data calculation and formatting.
microsoft office alternative - wps office

Frequently Asked Questions

Why does the Excel macro recorder skip certain actions?

The macro recorder focuses on capturing user actions that manipulate workbook data and cell formatting. It intentionally ignores application-level environment changes, general UI navigation, and system-level window adjustments because they do not directly alter the spreadsheet's content.

How do I enable the Developer tab to edit my VBA code on a Mac?

Go to the 'Excel' menu at the top, select 'Preferences', then click on 'Ribbon & Toolbar'. In the right-hand list of main tabs, check the box next to 'Developer' and click Save to reveal the tab on your ribbon.

Can I use VBA to open the Excel window on a specific secondary monitor?

Yes, by setting the 'Application.Left' property to a point value greater than the resolution width of your primary monitor, the macro forces the Excel application window to render on your extended secondary screen.

Will macros recorded on Windows work seamlessly on Excel for Mac?

Basic macros managing cell data and calculations work across both operating systems. However, macros that interact with file paths, ActiveX controls, or OS-specific libraries will fail on Mac and require platform-specific conditional VBA code to function correctly.