Prabu Mike
Prabu Mike

Reputation: 119

How can I bring other applications' windows to the front in Excel VBA?

I am using several applications to do my analysis step by step.

Instead of going to other applications (e.g. Excel, Word, IE, SAP, Outlook) by using AltTab manually, I want a button that will activate the next application and bring it to foreground and focus on it.

And there will be a non-modal dialog box which is coded in Excel VBA and should float around that application like the Search Dialog box in Microsoft Office.

All this functionality should be achieved in Excel VBA 2007.

Upvotes: 0

Views: 4155

Answers (1)

GolezTrol
GolezTrol

Reputation: 116200

Later versions of Windows (starting with 2000) are somewhat stricter in activating other applications and forcing them to the front. See the Remarks section on the documentation of SetForegroundWindow.

But since you want to simulate Alt+Tab, I think your best changes are to simulate an Alt+Tab key stroke using keybd_event.

Upvotes: 1

Related Questions