dble Posted May 13, 2015 Posted May 13, 2015 First just a quick question: Why does this fail?Run("winproj.exe")But this works?ShellExecute("winproj.exe");----------Main question - I want to write a script that:Closes MS Project completelyCopies an updated Global.mpt file from the serverRe-opens the same MS Project file the user was using I can pass the script a variable of the file name so re-opening should be easy. Copying is easy.What is the best way to close MS Project? I would prefer not to kill the process, so I wanted to ask your advice. I will be calling this script from the On Open event of MS Project so I suppose I will not have to worry about saving. Thanks much,dble
water Posted May 13, 2015 Posted May 13, 2015 When using Run you have to specify "The full path of the program (EXE, BAT, COM, or PIF) to run" (according to the help file). My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted May 13, 2015 Posted May 13, 2015 To close MS Project I would try something like this (untested and without any error checking):$oMSProject = ObjGet("", "MSProject.Application") $oMSProject.FileCloseAllEx(0) ; Close all projects without saving them $oMSProject.FileExit() ; Exit Ms Project My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
dble Posted May 14, 2015 Author Posted May 14, 2015 Thanks Water. I will work with your close example. I did see that Run wants the path but I didn't understand why "calc.exe" or "notepad.exe" without the full path works fine.
dble Posted May 14, 2015 Author Posted May 14, 2015 One more question, I can't seem to find documentation on FileCloseAllEx(). Is there an option to "SaveAll"?If a user had one file open, I updated the global, and then the user opened another file, the script would fire and all files would close and the first file wouldn't be saved.
water Posted May 14, 2015 Posted May 14, 2015 The MS Project Object Reference Model for MS Project 2010 can be found here.All Methods, properties etc. for the application object can be found here.$oMSProject.FileCloseAllEx(1) ; Close all projects and save them if neededThe enumeration PJSaveType can be found here (https://msdn.microsoft.com/en-us/library/ff867920(v=office.14).aspx). My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now