Erwin Craps - IT Helps
Erwin.Craps at ithelps.be
Tue May 25 01:45:38 CDT 2004
I was not folowing the thread but Word like Access but unlike Outlook is Multi Instance... Meaning You can have 5 times word.exe loaded, if this function would work how you gonna know which instance you gonna kill? Erwin -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jürgen Welz Sent: Tuesday, May 25, 2004 7:18 AM To: accessd at databaseadvisors.com Subject: RE: [AccessD] Orphaned program instances Is it not as simple as using a call to GetObject? Public Sub KillWord() Dim objWord as Word.Application Set objWord = GetObject(, "Word.Application") If objWord Is Nothing Then Else objWord.Close Set objWord = Nothing End If End Function You may need to iterate the Word documents collection and close those first. It could get ugly if the user has his own instance of Word open and you start killing off his documents. I don't use conventional merges relying on automation instead and have yet to have a problem with closing Word instances. Your best bet so as not to get a user instance is to use GetObject to secure pointers to all user instances before you begin your merge and then kill instance where the object is not the same as one of the user instances. For automation, it is usually enough to CreateObject and check that it is nothing when you are done. Ciao Jürgen Welz Edmonton, Alberta jwelz at hotmail.com >From: "John W. Colby" <jwcolby at colbyconsulting.com> > >I am doing mail merge and have times when instances of Word get >"orphaned", i.e. are loaded but not visible on the task bar. This >prevents the next merge cycle. I don't think that I am causing the >orphans, they don't happen often but they are occurring. I don't know >how to troubleshoot what is causing them, how they were opened etc. > >Is there any way to get a handle to these instances and close them >programmatically? > >John W. Colby >www.ColbyConsulting.com _________________________________________________________________ MSN Premium with Virus Guard and Firewall* from McAfee® Security : 2 months FREE* http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com