Hi, I'm using the following to make a connection between excel and SAP:
If Not IsObject(SAPApplication) Then
On Error GoTo SAP_NOT_OPEN:
Set SapGuiAuto = GetObject("SAPGUI")
Set SAPApplication = SapGuiAuto.GetScriptingEngine
End If
er = Err.Number
If Not IsObject(Connection) Then
Set Connection = SAPApplication.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
However, wscript is empty, and so the ConnectObject commands aren't performed and the macro cerashes. This used to work, so I could do with any pointers as to what may have changed?
Many thanks
Carl
If Not IsObject(SAPApplication) Then
On Error GoTo SAP_NOT_OPEN:
Set SapGuiAuto = GetObject("SAPGUI")
Set SAPApplication = SapGuiAuto.GetScriptingEngine
End If
er = Err.Number
If Not IsObject(Connection) Then
Set Connection = SAPApplication.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
However, wscript is empty, and so the ConnectObject commands aren't performed and the macro cerashes. This used to work, so I could do with any pointers as to what may have changed?
Many thanks
Carl