0

I did a script which saves an excel-file where the user wants to save it. I am using ExcelApplication.GetSaveAsFilname for this.

Now my problem is: This "Save-Dialog" opens behind all other windows (main-problem is that it opens behind SecureCRT where I need this script).

Please help.

Code snippet:

strPath = app.GetSaveAsFilename("output","Excel Files (*.xlsx), *.xlsx, All Files (*.*),*.*", , "Save as") 
    If strPath = False Then 
        Exit Sub
    End If
braX
  • 11,506
  • 5
  • 20
  • 33
AutMai
  • 187
  • 4
  • 18
  • Where is the script running? How do you start the script? – Tarik Jul 29 '20 at 12:08
  • SecureCRT - Script - Run – AutMai Jul 29 '20 at 13:00
  • Only a program in the foreground can set the foreground window. –  Jul 29 '20 at 20:56
  • Is Excel visible when you call that method? If not, call `app.Visible = True` beforehand, and ensure Excel is not minimized with `app.WindowState = -4143`. If you know the app name (title) or process ID of your Excel app, then try calling `With CreateObject("WScript.Shell") : .AppActivate "Excel" : End With` beforehand. If all else fails, [call Win32 APIs indirectly with PowerShell through VBScript](https://gist.github.com/codeartery/0ea3a74e92d39ce520cffb05a8b99446). HTH. – leeharvey1 Jul 31 '20 at 12:40
  • Also, in SecureCRT, ensure the "Bring console window to front" checkbox is unchecked under Preferences > General. – leeharvey1 Jul 31 '20 at 13:00

0 Answers0