答案 0 :(得分:0)
这很简单:
Sub Getuser()
Dim SapGuiAuto
Dim SetApp
Dim Connection
Dim Session
Set SapGuiAuto = GetObject("SAPGUI")
Set SetApp = SapGuiAuto.GetScriptingEngine
Set Connection = SetApp.Children(0)
Set Session = Connection.Children(0)
Session.FindById("wnd[0]").Maximize
Session.FindById("wnd[0]/mbar/menu[4]/menu[11]").Select
MsgBox Session.FindById("wnd[1]/usr/txtSYST-UNAME").Text
Session.FindById("wnd[1]/tbar[0]/btn[0]").Press
End Sub
答案 1 :(得分:0)
更容易的是:
UserId = Session.Info.User