Tjalve Posted March 8, 2012 Share Posted March 8, 2012 Hi everybody. Im writing a small script designed to run at all the computers where i work. The script is supposed to update everybodys contactlist and mailsignature. Anyway. I got the entire script to work perfectl and it goes exactly what i want, but there is one problem. The mailsignature part is based on a small part of code that i copied here from the forum (thanx water). The cod is as follows Local $oOL_Word = ObjCreate("Word.Application") Local $oOL_Doc = $oOL_Word.Documents.Add() Local $oOL_Selection = $oOL_Word.Selection $oOL_Selection = $oOL_Doc.Range() $iResult = _OL_MailSignatureCreate("mailsignature_1", $oOL_Word, $oOL_Selection, False, False) As i said. It works perfectly. The problem is that the program leaves the winword.exe process running after the program has finished, witch means that if the script run 2 times per day, you will have alot of winword applications in a few days. When you shutdown the system you have to forcefully close Word. That means that when you start word next time word "reacreates unsaved dockuemts" and present the user with alot of "unsaved documents". I can close it with processclose("winword.exe") but then the users who are runningw word when the script runm will see thair work go upp in smoke. I guess there is some way to close the $oOL_Word object. But i dont know that mutch about this kind of programming to know what to do. Any idees? Link to comment Share on other sites More sharing options...
water Posted March 8, 2012 Share Posted March 8, 2012 (edited) Use$oOL_Word.Quit $oOL_Word = 0 $oOL_Doc = 0 $oOL_Selection = 0 Edited March 8, 2012 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Tjalve Posted March 8, 2012 Author Share Posted March 8, 2012 Damn your fast... It works, but i get a popup windows asking me if i want to save the document befor closing. Link to comment Share on other sites More sharing options...
water Posted March 8, 2012 Share Posted March 8, 2012 Insert$oOL_Doc.Saved = Truebefore$oOL_Word.Quit My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Tjalve Posted March 9, 2012 Author Share Posted March 9, 2012 Works like a charm. Thank you! I tried looking trough the helpfile, but all i find is functions. And theese are not functions in that manner right? So is there some kind of tutorial och refference guide or something? Link to comment Share on other sites More sharing options...
water Posted March 9, 2012 Share Posted March 9, 2012 MSDN is your friend. Word 2007 or Word 2010. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Tjalve Posted March 13, 2012 Author Share Posted March 13, 2012 This is waaay out of my leuge... thanx anyway Link to comment Share on other sites More sharing options...
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