1

At line Set objBAPIControl = CreateObject("SAP.Functions") I face the runtime error 429

ActiveX component can't create object.

The script was initially running in a 32 bit system now it is upgraded to 64 bit.

This is the logon script:

Private Sub SAP_Initialize_Objects()


 Set objBAPIControl = CreateObject("SAP.Functions")
 Set sapConnection = objBAPIControl.Connection


 bln_SAP_Objects_Initiated = True

End Sub

If sapConnection.IsConnected <> 1 Then
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • What language, what error message, what two lines? Note that you must have installed SAP GUI for Windows to use `SAP.Functions`. – Sandra Rossi May 27 '21 at 15:22
  • Its is a VBA code. I have SAP GUI application installed. However, i get a runtime error 429 "ActiveX component can't create object." The script was initially running in a 32 bit system now it is upgraded to 64 bit Set objBAPIControl = CreateObject("SAP.Functions") This is the line that throws run time error. Please suggest. –  May 28 '21 at 11:51

1 Answers1

1

If you use MS Office 64 bits (I say "if" because in a 64 bits OS, MS Office 32 bits can be used), and SAP GUI 32 bits, then it won't work by default.

There are 3 possible solutions/workarounds:

  • Install SAP GUI for Windows 7.70 which is the first version to be 64 bits
  • Use the feature "DLL Surrogate" by changing the registry -> See this stack overflow answer
  • Convert VBA into VBScript that you run in 32 bits (outside your MS Office application)
    • Dim <var> As <type> in VBA ▶ Dim <var> in VBScript
    • etc. (search Web for differences, e.g. this (non-exhaustive) Microsoft document)
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • The company is not ready to upgrade the SAP to 7.7 for one user. DLL Surrogate is also not effective. Please explain to convert to VBS. –  Jun 10 '21 at 08:17
  • Impossible to explain how to convert, as it requires extensive VBA-VBS knowledge, but I added one tip and one link to my answer, to start helping you. Good luck! – Sandra Rossi Jun 10 '21 at 11:27