Log in

View Full Version : [SOLVED:] Activate a non-Excel Window



PinkyCyclops
07-18-2022, 09:42 AM
Hi everyone.
I'm working on an Excel sheet and one feature I would really need is for it to activate an external window (not Microsoft).
Is this even possible using VBA? Has anyone else had this need?

Thanks in advance.

Logit
07-18-2022, 02:57 PM
See if this works :


Sub RunAnExe()
Dim strX As String, varProc As Variant

On Error Resume Next

strX = "C:\Users\YourComputerNameHere\SomeOther.exe" 'Your path here

varProc = Shell(strX, 1)

End Sub

Logit
07-18-2022, 03:02 PM
Or maybe this :


Sub OpenConvertMe()
Dim RetVal
RetVal = Shell("C:\WINDOWS\Convert.EXE", 1)
End Sub

C:\WINDOWS\Convert.EXE" should be the full name and path to the program you want to open.

Paul_Hossler
07-18-2022, 04:27 PM
Hi everyone.
I'm working on an Excel sheet and one feature I would really need is for it to activate an external window (not Microsoft).
Is this even possible using VBA? Has anyone else had this need?

Thanks in advance.

Is the other program already running and you just want to switch to its window, OR do you want to start the second program?

PinkyCyclops
07-19-2022, 02:24 AM
Is the other program already running and you just want to switch to its window, OR do you want to start the second program?

Hi Paul
The other program is already running. Therein, lies the rub.

georgiboy
07-19-2022, 02:53 AM
I just got the below to bring my Amazon Music app to the front:

Sub test()
AppActivate ("Amazon Music")
End Sub

PinkyCyclops
07-19-2022, 03:18 AM
I just got the below to bring my Amazon Music app to the front:

Sub test()
AppActivate ("Amazon Music")
End Sub


That is excellent - mission accomplished!!
Thanks everyone!