On Windows Alt-Tab allows for quick cycle between different windows, likewise ctrl-pgup/dn allows for similar behaviour in browsers etc.

But how can you tab between different windows within vba and set focus on them? I'm specifically looking to jump between the main window and explorer window using the keyboard yet I can't figure it out


[CTRL][R] will take you to the explorer window.

[F7] will take you to the highlighted code window.

If you look at the View menu it will show you all the keyboard shortcuts.


Usually CtrlTab and CtrlShiftTab allows cycling between documents in an MDI window (as well as between tabs in browsers and tabbed dialog windows).

If that doesn't work, try CtrlF6 and CtrlShiftF6.

  • I am more looking at changing the focus onto the project window, so I can navigate the branches with arrow keys – user7158160 May 18 at 15:27

Using alt+tab is going to be very messy in a macro code.
Use AppActivate title, [ wait ] instead.

Title is the text at the top of the window.
For example "Google Chrome", remember it's very picky so remember uppercase and -.

This will set focus on another application from VBA code.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.