cancel
Showing results for 
Search instead for 
Did you mean: 

Excel Macro - GuiXT error message

Former Member
0 Kudos

Hello,

When GuiXT is activated and the following script is executed from excel macro

Pop up message "Can not find GuiXT component, check the installation"is displayed.

When GuiXT is deactivated no error message is displayed.

What can be done to avoid this pop up ?

If Not IsObject(SapGuiApp) Then

Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")

End If

If Not IsObject(Connection) Then

Set Connection = SapGuiApp.OpenConnection("QA", False)

End If

If Not IsObject(Session) Then

Set Session = Connection.Children(0)

End If

If how = "maximize" Then

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

Else

If how = "iconify" Then

Session.findById("wnd[0]").iconify

Else

Session.findById("wnd[0]").iconify

End If

End If

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

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

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

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

......

Thanks,

Ziv

Accepted Solutions (1)

Accepted Solutions (1)

script_man
Active Contributor
0 Kudos

Hi Ziv,

The object "Sapgui.ScriptingCtrl.1" does not support the GuiXT. So the error does not come, you must first disable GuiXT. Or you can use a helper script.

For example:


set wshell = createObject("Wscript.Shell")
wshell.run "./script_activate.vbs Information"

If Not IsObject(SapGuiApp) Then
Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
. . .

script_activate.vbs:


if wscript.arguments.count > 0 then
 window_title = wscript.arguments(0)
 set wshell = createobject("Wscript.Shell")
 number = 0
 Do 
  bWindowFound = Wshell.AppActivate(window_title)
  WScript.Sleep 500
  number = number + 1
  if number > 10 then exit do
 Loop Until bWindowFound
 
 wscript.sleep 200
 Wshell.AppActivate window_title
 wscript.sleep 200
 wshell.sendkeys "{Enter}"
 wscript.sleep 200
end if

Regards,

ScriptMan

Former Member

Answers (0)