Jump to content

Recommended Posts

If Excel is the default app for .xlsx files on your PC, then you can just use:

ShellExecute("C:\test\test.xlsx", "", "", "", @SW_MINIMIZE)

if not, then you could try: (assumes excel.exe can be found in the PATH)

ShellExecute("Excel.exe", '"C:\test\test.xlsx"', "", "", @SW_MINIMIZE)

 

 

Edited by TheXman
Link to post
Share on other sites

Neither of these two options work for me either:

ShellExecute("Excel.exe", '"C:\Users\My User\Desktop\Book1.xlsx"', "", "", @SW_MINIMIZE)
ShellExecute('"C:\Users\My User\Desktop\Book1.xlsx"', "", "", "", @SW_MINIMIZE)

Windows 10 latest, Excel 365.  It opens the file in Excel, but Excel is not minimized. @SW_MAXIMIZE does work.

The only way I can ensure that Excel is minimized is by minimizing it separately:

ShellExecute ("Excel.exe", '"C:\Users\My User\Desktop\Book1.xlsx"', "", "")
WinActivate ("Book1.xlsx - Excel", "")
WinWaitActive ("Book1.xlsx - Excel", "")
Send ("#{DOWN}")

or:

ShellExecute ("Excel.exe", '"C:\Users\My User\Desktop\Book1.xlsx"', "", "")
WinWaitActive ("Book1.xlsx - Excel", "")
WinSetState ("Book1.xlsx - Excel", "", @SW_MINIMIZE)

 

Edited by leuce
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...