Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bringing Excel to the Front - AppActivate?

Status
Not open for further replies.

Phantek

Programmer
Apr 25, 2011
29
US
I have an Excel file with macros in it that is being run on a server where the user will log out after 15 minutes of inactivity, and if the user does not save the file before the log out they will lose all changes made.

I have set up some ways of detecting how long it has been since the user has conducted certain actions. If the user has not done anything for 12 minutes, a form will load advising the user that the program will auto-save and close unless a button is clicked within 30 seconds.

That sounds good in theory - the problem I am having is getting my Excel file to be the active program once the 12 minutes have hit. After having read through the forums, I am trying to use appactivate. So with the filename of myFile.xls I have tried:

Code:
AppActivate "Microsoft Excel"
AppActivate "myFile.xls"
AppActivate "Microsoft Excel - myFile.xls"

And nothing has worked. Any suggestions?
 
Try using a window state like

Application.WindowState = xlMaximized

or

Application.WindowState = xlNormal



 
The xlNormal did not seem to do much, but the xlMaximized did the trick - thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top