cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX Component Error (429) on SAPGUI

0 Kudos

Hi,

I've been trying to troubleshoot why I cannot gain access to the SAP GUI through VBA. I came across this similar question sap gui scripting activex 429 error | SAP Community, however I am currently working with 32-bit excel (Office 365). When trying to connect to the SAP GUI, I am hit with "Run-time error '429': ActiveX component can't create object." I have been using just this simple code in order to try and establish the connection:

Option Explicit
Public sapgui, wscript, msgcol
Public ObjGui as GuiApplication
Public ObjConn as GuiConnection
Public session as GuiSession
-----------------------------------------------------------
Sub ConnectSAP()
Set SapGui = CreateObject("SAPGUI") '(This is where the 429 error occurs)
End Sub
----------------------------------------------------------

Steps I've taken/observations:

I've included the SAP GUI Scripting API (sapfewse.ocx) in the VBA references panel

I've noticed that other SAP functions work without issue (i.e. CreateObject("SAP.Functions"))

I've noticed that in the loaded DLLs information from within the SAP GUI, I do not see sapfewse.ocx listed (unsure if I should)

Additional research has been mentioning the possibility of having to update registry keys, but am unsure how to safely do this, and would pursue this option once I know I'm not missing something else here.

The SAP GUI version is 760

Windows 10 Enterprise 6.2

Any help is amazing appreciated, would go a long way to unlocking so many automation projects with VBA

jerryjanda
Community Manager
Community Manager
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. And thank you for providing so many details about your issue. This information will make it easier for other members to answer.

One suggestion: Use the "insert code" feature to make your question easier to read. Should you wish, you can revise your question by selecting Actions, then Edit. You'll see the "insert code" button on the upper right of the interface.

I also recommend that you include a profile picture. By personalizing your profile, you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html.

Kind regards,

--Jerry

Moderation Lead

Sandra_Rossi
Active Contributor
0 Kudos

You want to connect to SAP GUI, so do you mean SAP GUI is already started by the user?

In that case, this code should work:

Dim rotEntry As Object
Set rotEntry = GetObject("SAPGUI")
Set application = rotEntry.GetScriptingEngine
Set connection = application.connections(0)

If you want to start SAP GUI, it's different code, you must use WScript (for instance), use "run", indicate the path to saplogon.exe program, wait until it's started, etc.

0 Kudos

Hello, thanks for the feedback. Yes, this is with the GUI already opened by the user.

The above code still hits the run time error (ActiveX Component can't create object) at

Set rotentry = GetObject("SAPGUI")
Sandra_Rossi
Active Contributor
0 Kudos

With SAPGUI.Application?

Set rotEntry = CreateObject("SAPGUI.Application")

If it doesn't work, re-install SAP GUI with all components (including SAP GUI Scripting component - maybe it's missing, possibly related to "I do not see sapfewse.ocx").

0 Kudos

Re-install provided the same results as far as .dlls/.ocx references are concerned.

On trying

Set rotEntry = CreateObject("SAPGUI.Application")

I'm able to advance to the next line, however now at the following line:

Set application = rotEntry.GetScriptingEngine

I'm getting a run time error 438 "This object doesn't support this property or method". Not seeing any options within intellisense either as potential object properties for the rotEntry variable. Total code used below:

Option Explicit
Sub SAP()
Dim app as GuiApplication
Dim connection as GuiConnection
Dim rotEntry as Object
Set rotEntry = CreateObject("SAPGUI.Application")
Set app = rotEntry.GetScriptingEngine '438 ERROR Object doesn't support this property or method
Set Connection = app.Connections(0)
End Sub
Sandra_Rossi
Active Contributor
0 Kudos

I think the bug is explained in note 2645186 and workaround is given.

Accepted Solutions (0)

Answers (0)