Silent Connection with SAPLOGON

jonascruz

New Member
Joined
May 19, 2016
Messages
6
Hi. I'm trying to connect to SAP Logon with VBA but I'm getting the error 429: The ActiveX component can not create the object.

In this point 429 error:
Code:
Set oBapiCtrl = CreateObject ("sap.bapi.1")
    Set oBapiLogon = CreateObject ("sap.logoncontrol.1")

VBA Code:
Code:
Sub sap()
    Dim oBook As Workbook
    Dim oShee As Workbook
    Dim oBapiCtrl As Object
    Dim oBapiLogon As Object
    Dim oSalesOrder As Object
    Dim oCustumer As Object
    Dim oProduct As Object
    Dim oItem As Object
    Dim oIndex As Integer
    
    Set oBook = Application.ActiveWorkbook
    Set oSheet = oBook.Worksheets(1)
    
    Set oBapiCtrl = CreateObject("sap.bapi.1")
    Set oBapiLogon = CreateObject("sap.logoncontrol.1")
    
    oBapiCtrl.Connection = oBapiLogon.NewConnection
    oBapiCtrl.Connection.ApplicationServer = "000.000.000.000" 'I put my correct IP
    oBapiCtrl.Connection.System = "000" 
    oBapiCtrl.Connection.Client = "000"
    oBapiCtrl.Connection.User = "Jonas"
    oBapiCtrl.Connection.Password = "MyPassword"
    oBapiCtrl.Connection.Language = "PT"
    oBapiCtrl.Connection.SystemNumber = "00"
    
    If oBapiCtrl.Connection.Logon(0, True) <> True Then
        MsgBox "Not connect", vbInformation, "Sap Logon"
        Exit Sub
    End If
    
End Sub

I install this module

Under Tools | References in the VBA Editor menu, scroll to you find the SAP objects


  • Select SAP Data Provider (sapdattap.ocx)
  • Select SAPGUIRessources (sapguirm.ocx)
Could they help where the mistake might be? I need to connect the sap


****** id="cke_pastebin" style="position: absolute; top: 664px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">Could they help where the mistake might be? I need to connect the sap</body>
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,215,461
Messages
6,124,952
Members
449,198
Latest member
MhammadishaqKhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top