Run-time error 438

Rbveiga

New Member
Joined
Sep 11, 2014
Messages
28
Hello,

I have excel macro which should open and log in into my SAP but appaer the error message "Run-time error 438 Object doesn't support this property or method"

Here is the code which I am using

Rich (BB code):
Sub Vendors_to_IC_statement()
Dim pword As String
pword = InputBox("Please enter your password to SAP FP3", "Password Required", "*******")
User = Sheet4.Range("i1").Value = Environ("Username")
If Not IsObject(SapGuiApp) Then
    Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(Connection) Then
    Set Connection = SapGuiApp.OpenConnection("FP3", False)
End If
If Not IsObject(Session) Then
    Set Session = Connection.Children(0)
End If
'Login to SAP
Session.FindById("wnd[0]/usr/txtRSYST-MANDT").Text = "010"
Session.FindById("wnd[0]/usr/txtRSYST-BNAME").Text = User
Session.FindById("wnd[0]/usr/pwdRSYST-BCODE").Text = pword
Session.FindById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"
Session.FindById("wnd[0]/usr/txtRSYST-LANGU").SetFocus
Session.FindById("wnd[0]/usr/txtRSYST-LANGU").caretPosition = 2
Session.FindById("wnd[0]").sendVKey 0
pword = ""
MsgBox "If you click on the OK button, the SAP session is terminated."
End Sub
The error start on :
Rich (BB code):
Session.FindById("wnd[0]/usr/txtRSYST-MANDT").Text = "010"


would you know what I am missing?

regards,
 
Last edited by a moderator:

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I found out already. Forgot to add

code:

Dim SAPguiAPP As SAPFEWSELib.GuiApplication
Dim Connection As SAPFEWSELib.GuiConnection
Dim Session As SAPFEWSELib.GuiSession



Do you know which code should ignore the amcro incase the log in is already on ?


regards,

Hello,

I have excel macro which should open and log in into my SAP but appaer the error message "Run-time error 438 Object doesn't support this property or method"

Here is the code which I am using

Rich (BB code):
Sub Vendors_to_IC_statement()
Dim pword As String
pword = InputBox("Please enter your password to SAP FP3", "Password Required", "*******")
User = Sheet4.Range("i1").Value = Environ("Username")
If Not IsObject(SapGuiApp) Then
    Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(Connection) Then
    Set Connection = SapGuiApp.OpenConnection("FP3", False)
End If
If Not IsObject(Session) Then
    Set Session = Connection.Children(0)
End If
'Login to SAP
Session.FindById("wnd[0]/usr/txtRSYST-MANDT").Text = "010"
Session.FindById("wnd[0]/usr/txtRSYST-BNAME").Text = User
Session.FindById("wnd[0]/usr/pwdRSYST-BCODE").Text = pword
Session.FindById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"
Session.FindById("wnd[0]/usr/txtRSYST-LANGU").SetFocus
Session.FindById("wnd[0]/usr/txtRSYST-LANGU").caretPosition = 2
Session.FindById("wnd[0]").sendVKey 0
pword = ""
MsgBox "If you click on the OK button, the SAP session is terminated."
End Sub
The error start on :
Rich (BB code):
Session.FindById("wnd[0]/usr/txtRSYST-MANDT").Text = "010"


would you know what I am missing?

regards,
 
Upvote 0

Forum statistics

Threads
1,215,433
Messages
6,124,861
Members
449,195
Latest member
MoonDancer

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