How Can We Help?
< All Topics

Activating the correct Excel worksheet when multiple worksheets are open.

We have had a few people report problems with activating the correct Excel workbook when multiple worksheets are open. Looking into this problem we discovered several (more) eccentricities with Excel. In order to activate the correct worksheet we had to make the following adjustments:

    1. Ungroup the similar taskbar buttons. To do this right-click on the Taskbar and left-click on the Properties menu item. In the Taskbar tab, make sure that the “Group similar taskbar buttons” is not selected. In Windows 7, change the Taskbar buttons dropdown menu to Never Combine. This displays each worksheet with a separate taskbar button, instead of grouping them into a menu.

    2. Only use the worksheet name in the Activate Window command. Do not include ‘Microsoft Excel’ or ‘Excel’ as part of the window title.

Here’s an example using 5 open worksheets – Book1, Book2, Book3, Book4 and Book5, with Book1 having focus. If I open Windows Task Manager to view the Applications currently running, it lists the following applications:

Microsoft Excel – Book1, Book1, Book2, Book3, Book4 and Book5.

Entering Book2 as the window title in the Activate Window command will activate the correct window. The macro fails if Microsoft Excel – Book2 is entered, because the title cannot be found.

– Applies to: Macro Express and Macro Express Pro