In SAP GUI, I always open 6 windows every time, but whenever I run macro from Excel to SAP GUI, Excel will always choose the first SAP GUI window.
My question, is it possible for me to choose the macro in Excel to run in second SAP window or other than the first?
Here is the basic code for the connection.
If Not IsObject(SAPApp) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set SAPApp = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(SAPConnection) Then
Set SAPCon = SAPApp.Children(0)
End If
If Not IsObject(session) Then
Set session = SAPCon.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject SAPApp, "on"
End If