[AccessD] Closing Word

Beach Access Software bchacc at san.rr.com
Sat Jan 20 22:21:11 CST 2007


Marty:

I don't have a problem with it on my machine.  But my client gets an
Automation Error on the Set objWord = line.  We can't figure out why.

In the process I noticed that WINWORD was left open in the Processes form of
the Task Manager, even after I closed the word doc.  So I added Set objWord
= Nothing and that solved the problem.  However I can't explain why, even
after the code executes the Set objWord = Nothing line, the word doc still
stays open.  That's OK with me.  I don't care.  But it is curious that I can
set the object pointer to nothing and the word doc is still open.


Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of MartyConnelly
Sent: Saturday, January 20, 2007 5:06 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Closing Word

You could try just before the line

Set objWord = Nothing

objWord.quit


Beach Access Software wrote:

>Bryan:
>
>I agree with you.  But Access disagrees with us.  Here's the code:
>
>Private Sub cmdDisplayWordDoc_Click()
>
>Dim objWord As Word.Application
>Dim objWordDoc As Word.Document
>
>Set objWord = New Word.Application
>
>With objWord
>    'Visible is set True in order to view the operation.
>    .Visible = True
>    .Documents.Open (Me.fldFABWorkInstructions)
>End With
>
>Set objWord = Nothing
>
>End Sub
>
>I run it with the task manager open to processes and as it goes through the
>code WINWORD opens up and the document is displayed.  I put a breakpoint at
>End Sub just to satisfy myself that the code passed through the Set objWord
>= Nothing.
>
>WINWORD disappears from the task managers' processes screen but the
document
>is still open.
>
>Go figure...
>
>Rocky Smolin
>Beach Access Software
>858-259-4334
>www.e-z-mrp.com
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bryan Carbonnell
>Sent: Saturday, January 20, 2007 6:56 AM
>To: Access Developers discussion and problem solving
>Subject: Re: [AccessD] Closing Word
>
>On 1/17/07, Beach Access Software <bchacc at san.rr.com> wrote:
>  
>
>>Never mind.  I think.  Adding Set objWord = Nothing at the end of the
>>routine seems to work. It leaves the document open and there's no WINWORD
>>left in the task manager's processes.
>>    
>>
>
>Sorry, just catching up, but....
>
>No Winword in Task manager, but the Word doc is still open?
>Impossible. (now that I say that someone is going to prove me wrong)
>
>Winword is Word. Without it, being present you won't have the document
open.
>
>can you elaborate a bit more? I'm curious.
>
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.3/642 - Release Date: 1/20/2007
10:31 PM
 




More information about the AccessD mailing list