VBA Code in Excel 32 BIT Working fine & 64 BIT having issue

Rohith1324

Board Regular
Joined
Feb 27, 2018
Messages
114
Request you to please help on this as I'm not understanding how this issue can be fixed :

In System with Excel 32 BIT below code is getting executed successfully , but the same step when try in Excel 64 BIT I'm getting error :

Code :

If Not IsObject(SAPguiApp) Then
Set SAPguiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(Connection) Then
Set Connection = SAPguiApp.OpenConnection("- SAP ERP", True)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If

Error screenshot :

1627652217841.png



Issue is at :

But when I'm trying in 64 BIT it is getting stopped at line - Set SAPguiApp = CreateObject("Sapgui.ScriptingCtrl.1") ( Not sure if 32 BIT or 64 BIT is the problem here but I see this is the only difference from the system i'm using )

can someone suggest how I can fix this.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
1. make sure all your api DECLARES have PTRSAFE on them.
2. make sure the 64 bit version REFERENCES point to the new versions of Dll, or ocx, etc.
 
Upvote 1
1. make sure all your api DECLARES have PTRSAFE on them.
2. make sure the 64 bit version REFERENCES point to the new versions of Dll, or ocx, etc.
Hi, I have the users who are 32 bit as well 64 bit....could you please help how that can be fixed..
 
Upvote 0
It is possible there isn't a 64bit version of that class, in which case you are out of luck. Do the 64bit users have SAP installed and working?
 
Upvote 0
I know very little about this, so this is probably my only contribution to this.
But all I could find is one web site requiring a registry change, not sure that is something that is likely to happen.
And one corrupted web page that has the code below but it looks incomplete to me since it has no Dim statements.

VBA Code:
Sub Test()

    Set SapGuiAuto = GetObject("SAPGUI")
    Set appl = SapGuiAuto.GetScriptingEngine
    Set Connection = appl.Children(0)
    Set session = Connection.Children(0)
    Set info = session.info
    Debug.Print info.Program

End Sub
 
Upvote 0
I know very little about this, so this is probably my only contribution to this.
But all I could find is one web site requiring a registry change, not sure that is something that is likely to happen.
And one corrupted web page that has the code below but it looks incomplete to me since it has no Dim statements.

VBA Code:
Sub Test()

    Set SapGuiAuto = GetObject("SAPGUI")
    Set appl = SapGuiAuto.GetScriptingEngine
    Set Connection = appl.Children(0)
    Set session = Connection.Children(0)
    Set info = session.info
    Debug.Print info.Program

End Sub
So, I am having this exact same problem, I have tried the code that you have above... It worked yesterday, but when I logged on this morning, I realized that my script failed again... What I have found is that I need to have the SAP logon screen open, which is annoying, but should allow my code to run until I have time to fully figure out how to make it work again...
 
Upvote 0
1. make sure all your api DECLARES have PTRSAFE on them.
2. make sure the 64 bit version REFERENCES point to the new versions of Dll, or ocx, etc.
Thank you!!! I knew there was something but forgot what it was called. The PTRSafe is what I was looking for. 😎👍
 
Upvote 0

Forum statistics

Threads
1,215,352
Messages
6,124,451
Members
449,161
Latest member
NHOJ

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