Fix Excel VBA Workbooks.Open Not Activating a Workbook
Question details
The user needs a workbook opened by Excel VBA to become active while or after a UserForm is displayed.

- 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.
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.
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.
In the VBA editor, find the procedure that calls UserForm1.Show, replacing UserForm1 with your form's name.
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.
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.

Review workbook events and explicitly activate the opened workbook
Use this approach if another event or a statement after the form closes may be changing the active workbook.
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.

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.




