Skip to Content
Jul 28, 2018 at 02:09 PM

Script for log on keeps Excel "thinking"


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").caretPosition = 2
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 0