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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
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,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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