Luc, i replaced my code with this. in this case the script goes thru the bold lines below,
hence the session and app are not set. so fails when it hits the transaction recording statement
If Not IsObject(app) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set app = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(Connection) Then
Set Connection = app.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 app, "on"
End If
......
....
Fails at line below
session.findById("wnd[0]/tbar[0]/okcd").Text = "/nsm30"
As i mentioned this works fine when i am connected directly in the network. Fails only when i connect to SAP via VPN
help is appreciated