[AccessD] Orphaned program instances

Jürgen Welz jwelz at hotmail.com
Tue May 25 09:03:14 CDT 2004


Which is why I suggest you explicitly create a Word instance and get an 
object pointer to it and then use that instance for your purposes.  If you 
are working in a RAM bound system (there was a time when all my users ran 
WinNT4, Office97 on 32 megabyte machines and I only created a Word object if 
it didn't already exist and killed it only if my code created that 
instance), additional considerations may apply.

If you simply create new instances for your code, you can compare object 
instances with any you get from CreateObject and only destroy it if they are 
the same.  The problem John is likely having is that there is an unclosed 
object reference to a Word Table or Selection or Bookmark or Document 
arising from the merge.

This approach will warn you that you have unclosed instances hanging about 
and you may as well make them visible so the user can kill them rather than 
notifying them and having him go to task manager.  As long as the instance 
is still hanging around you can still use GetObject to reuse the one you 
can't kill rather than keep on creating additional instances.  Again, this 
works well with automation and I can't really comment on conventional merges 
because I don't use them.

I occasionally had failures to kill Word application instances before I 
fixed my error handling to close all objects in the exit code of all 
procedures but have not had such a problem using automation for several 
years.  I know this can't be a problem with John's code so I assume it's 
something to do with merging to Word.

Ciao
Jürgen Welz
Edmonton, Alberta
jwelz at hotmail.com





>From: "Erwin Craps - IT Helps" <Erwin.Craps at ithelps.be>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: "Access Developers discussion and problem 
>solving"<accessd at databaseadvisors.com>
>Subject: RE: [AccessD] Orphaned program instances
>Date: Tue, 25 May 2004 08:45:38 +0200
>MIME-Version: 1.0
>Received: from mc4-f40.hotmail.com ([65.54.190.176]) by mc4-s14.hotmail.com 
>with Microsoft SMTPSVC(5.0.2195.6824); Mon, 24 May 2004 23:48:12 -0700
>Received: from databaseadvisors.com ([209.135.140.44]) by 
>mc4-f40.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Mon, 24 May 2004 
>23:46:44 -0700
>Received: from databaseadvisors.com (databaseadvisors.com 
>[209.135.140.44])by databaseadvisors.com (8.11.6/8.11.6) with ESMTP id 
>i4P6jvQ17763;Tue, 25 May 2004 01:45:57 -0500
>Received: from potassium.iops.versanet.be ([212.53.4.31])by 
>databaseadvisors.com (8.11.6/8.11.6) with ESMTP id i4P6jOQ16981for 
><accessd at databaseadvisors.com>; Tue, 25 May 2004 01:45:24 -0500
>Received: from stekelbes.ithelps.be (cust70-2.dsl.versadsl.be 
>[62.166.70.2])by potassium.iops.versanet.be (Postfix) with ESMTP id 
>717663EE26for <accessd at databaseadvisors.com>;Tue, 25 May 2004 08:45:58 
>+0200 (CEST)
>X-Message-Info: NDMZeIBu+sozsxmmF3QPPwuwgjFK2muXiY4VLwGkv7s=
>content-class: urn:content-classes:message
>Message-ID: 
><46B976F2B698FF46A4FE7636509B22DF0AD910 at stekelbes.ithelps.local>
>X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1
>X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [AccessD] Orphaned 
>program instances
>Thread-Index: AcRCGkkvfF2BjiIjR1epfrpk2GrscAACUy7g
>X-MIME-Autoconverted: from quoted-printable to 8bit by databaseadvisors.com 
>idi4P6jOQ16981
>X-BeenThere: accessd at databaseadvisors.com
>X-Mailman-Version: 2.1.4
>Precedence: list
>List-Id: Access Developers discussion and problem 
>solving<accessd.databaseadvisors.com>
>List-Help: <mailto:accessd-request at databaseadvisors.com?subject=help>
>List-Post: <mailto:accessd at databaseadvisors.com>
>List-Subscribe: 
><http://databaseadvisors.com/mailman/listinfo/accessd>,<mailto:accessd-request at databaseadvisors.com?subject=subscribe>
>List-Archive: <http://databaseadvisors.com/pipermail/accessd>
>List-Unsubscribe: 
><http://databaseadvisors.com/mailman/listinfo/accessd>,<mailto:accessd-request at databaseadvisors.com?subject=unsubscribe>
>Errors-To: accessd-bounces at databaseadvisors.com
>Return-Path: accessd-bounces at databaseadvisors.com
>X-OriginalArrivalTime: 25 May 2004 06:46:44.0897 (UTC) 
>FILETIME=[0B4B8110:01C44224]
>
>
>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
>--
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com

_________________________________________________________________
Add photos to your messages with MSN Premium. Get 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




More information about the AccessD mailing list