使用以下代码登录SAP。
Sub Logontrial()
Dim SapGuiApp As Object
Dim oConnection As Object
Dim session As Object
Dim SAPCon As Object, SAPSesi As Object
Dim SAPGUIAuto As Object, SAPApp As Object
Dim sapConnection As Object
If SapGuiApp Is Nothing Then
Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If oConnection Is Nothing Then
Set oConnection = SapGuiApp.OpenConnection("Description of connection")
End If
If SAPSesi Is Nothing Then
Set SAPSesi = oConnection.Children(0)
End If
sapConnection.Client = "011"
sapConnection.User = "TEST123"
sapConnection.Password = "XXXX"
sapConnection.Language = "EN"
End Sub
运行时错误'1000'。未找到SAP登录连接条目。已在此主题中完成了充足的R& D.仍然没有成功。对此代码的更正将不胜感激。
答案 0 :(得分:0)
@AxelRichter的上述评论为我解决了这个问题:
在SapGuiApp.OpenConnection(“连接说明”)中,连接说明必须与登录连接中显示的SAP连接名称完全匹配。
答案 1 :(得分:0)
NAME NAME NAME是东西。 我遇到了同样的问题,一直以来,我都在宏上继续使用SID(3个字符),然后停止工作,然后将其更改为连接的名称(DESCRIPTION OF THE CONNECTION),然后它起作用了。感谢Axel Richter的评论。