Hi Brit,
this questionwould be betterplacedinScripting Languages. But I did read it anyway. ![]()
You couldtry the following:
for example:
PATH = "C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe"
on error resume next
Set SapGuiAuto = GetObject("SAPGUI")
if err.number <> 0 then
msgbox " 'SAP Logon' is not active.", vbInformation, "Information"
else
on error goto 0
Set application = SapGuiAuto.GetScriptingEngine
on error resume next
Set connection = application.Children(0)
if err.number <> 0 then
msgbox " No SAP - Session is active.", vbInformation, "Information"
else
on error goto 0
while connection.children.count > 0
Set session = connection.Children(0)
session.findbyid("wnd[0]").close
on error resume next
session.findById("wnd[1]/usr/btnSPOP-OPTION1").press
on error goto 0
wend
end if
set wshell = createObject("Wscript.Shell")
wshell.run chr(34) & PATH & chr(34)
wscript.Sleep 500
bWindowFound = Wshell.AppActivate("SAP Logon")
if bWindowFound then
Wshell.appActivate "SAP Logon"
WScript.Sleep 200
Wshell.sendkeys "%{F4}"
WScript.Sleep 200
end if
end if
Of course there are many other solutions that are much more elegant.
Regards,
ScriptMan