VBA & Macro Problems

Fix Excel VBA Workbooks.Open Not Activating a Workbook

Maira MehtabMaira Mehtab Nov 25, 2026 870 views

Question details

The user needs a workbook opened by Excel VBA to become active while or after a UserForm is displayed.

Fix Excel VBA Workbooks.Open Not Activating a Workbook
Product
Microsoft Excel VBA
Device & OS
not provided
Scenario
A macro opens a workbook from a UserForm, or workbook event code runs during the opening process.
Observed behavior
The newly opened workbook may not appear to receive focus or remain active.
Before you start

Open the VBA editor with Alt+F11 and locate the code that displays the UserForm and opens the workbook. Note whether the user needs to interact with Excel while the form remains visible.

Solution 1Recommended

Show the UserForm modeless when Excel must remain interactive

Use a modeless form if the user needs to work with the newly opened workbook while the form is visible.

A modal UserForm restricts interaction with the Excel interface until the form is hidden or unloaded. Showing a form modeless allows interaction, but the calling code continues immediately after the Show statement.

1
Find the form display code

In the VBA editor, find the procedure that calls UserForm1.Show, replacing UserForm1 with your form's name.

2
Show the form modeless

Change the call to UserForm1.Show vbModeless. Alternatively, select the form in the VBA editor and set its ShowModal property to False in the Properties window.

3
Test the workbook workflow

Run the macro, use the form to open the workbook, and check whether you can select and work in the workbook while the form remains visible.

Show the UserForm modeless when Excel must remain interactive
Use modeless only when needed: A modal form can work correctly when interaction with Excel is not required until the form closes. Review any code after Show because its execution timing changes when the form is modeless.
Free Microsoft Office alternative

Work with Excel spreadsheets in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and Excel format compatibility for an easier move between office suites. It does not fix Excel VBA activation behavior.

Open and edit spreadsheet data in a familiar interfaceCompatible with Microsoft Excel XLSX filesFree and lightweight for everyday office tasksMove spreadsheet work between office suites with less disruption
microsoft office alternative - wps office

Frequently Asked Questions

Does Workbooks.Open automatically make the new workbook active?

Workbooks.Open normally opens the workbook, but a modal form or other VBA code can affect what the user can interact with or which workbook remains active. Store its return value in a Workbook variable and call wb.Activate when appropriate.

How do I allow users to interact with Excel while a UserForm is open?

Show the form with UserForm1.Show vbModeless, or set the form's ShowModal property to False in the VBA editor. The calling procedure continues immediately when the form is shown modeless.

Where can I find code that runs when a workbook opens?

Press Alt+F11, find the opened workbook in Project Explorer, and inspect the Workbook_Open procedure in its ThisWorkbook module. Application-level event handlers can also run when a workbook opens.

When does code after a modal UserForm.Show statement run?

The calling procedure normally waits until the modal form is hidden or unloaded before continuing. Check those later statements for workbook or window activation commands.