#2 ScriptMan
Dodatok:
Ked by bol tvoj kod VBA v excelu a nie VBS, ako som si ja myslel, tak musis pouzit tvoj originalny kod len s dvoma malymi zmenami:
Sub test()
Dim application
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]/tbar[0]/okcd").text = "co03"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtCAUFVD-AUFNR").text = "6511850"
session.findById("wnd[0]").sendVKey 0
PODLOZKA = session.findById("wnd[0]/usr/txtCAUFVD-MATXT").text
session.findById("wnd[0]/tbar[0]/btn[3]").press
session.findById("wnd[0]/tbar[0]/btn[3]").press
Windows("SGA.xlsm").Activate
Sheets("Sheet1").Select
Range("A1").Value = PODLOZKA
End Sub
S pozdravom
ScriptMan