Hi All,
I am trying to export a table field value from sap to excel i used the the below script as a test for logon
this was working initially but now i am facing an error "Runtime error 429 Activex component can't create object" on this line"Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")".
i used the same computer for both the run.
Sub testlogon()
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("System", True)
End If
If SAPSesi Is Nothing Then
Set SAPSesi = oConnection.Children(0)
End If
Application.DisplayAlerts = False
With SAPSesi
.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "200"
.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "xxxxxxx"
.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "xxxxxx"
.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"
.findById("wnd[0]").sendVKey 0
'start extraction
.findById("wnd[0]").maximize
.findById("wnd[0]/tbar[0]/okcd").Text = "/NEX"
.findById("wnd[0]").sendVKey 0
End With
Application.DisplayAlerts = True
MsgBox "SAP session is terminated."
End Sub
Thanks in advance
Regards,
Febin Roy





