cancel
Showing results for 
Search instead for 
Did you mean: 

Script for log on keeps Excel "thinking"

0 Kudos

Hello Everyone,

I am working in a solution to help people from the company that I work. The script is basically confirm work time at IW41. that was working grat until I set Excel to log on by script. After the script confirm the work time and close the order service the software(Excel) goes like infinity loop and it didn't stop. I have to force excel quit.

Have someone seen something like that?

The script is the following,

Sub comNota() 'Cod Apontamento Hora Application.ScreenUpdating = False
On Error GoTo Here: If Not IsObject(SapGuiApp) Then
Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(Connection) Then
Set Connection = SapGuiApp.OpenConnection("(29) P1P - Cordillera UASCC ECC Production", True)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject App, "on"
End If
session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "010"
session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "my user"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "my password"
session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "pt"
session.findById("wnd[0]/usr/txtRSYST-LANGU").SetFocus
session.findById("wnd[0]/usr/txtRSYST-LANGU").caretPosition = 2
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

I did this way and it worked:

session.findById("wnd[0]").maximize

session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "100"

session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = "***"

session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "***"

session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"

session.findById("wnd[0]").sendVKey 0

Set Session = Nothing

Set connection = Nothing

Set sap = Nothing