‎2018 Jul 21 7:38 PM
Hey team! I need help switching between two windows in SAP using only SAP. My code is below but it keeps returning errors. I've done quite a bit of research and just can't figure it out.. If possible please modify this code to show me the correct version with an explanation. That would literally help so much.
'MsgBox ("STO made.. will now attempt to post")
'Set session = application.ActiveSession(1) - TRIED THIS IT DIDN'T WORK
'sapcon.children(1).select - TRIED THIS IT DIDN'T WORK
Set SapGuiAuto = GetObject("SAPGUI")
Set SapApp = SapGuiAuto.GetScriptingEngine
With SapApp.Connections(0).sessions(0)
.createsession
End With
k = SapApp.Connections.Item(0).sessions.Count
Set Session = SapApp.Connections.Item(0).sessions.Item(CLng(k - 1))