Close Word from Access - Please Help

shamas21

Registered User.
Local time
Today, 15:26
Joined
May 27, 2008
Messages
162
Hi All

Ive been trying for hours to close a word document i have.

I open it from Access VBA with the following code

Code:
[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Dim MSWord As New Word.Application
Set MSWord = New Word.Application[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]MSWord.Documents.Open FileName:="V:\Confirmation Of Instructions - Capital Visas"[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]MSWord.Selection.TypeText Text:="Line 1"[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]MSWord.Documents.Close[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Set MSWord = Nothing[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]
[COLOR=black][FONT=Verdana]

But it doesnt completely close the Word document; instead it leaves a temporary file called '~$nfirmation Of Instructions - Capital Visas' which indicates to me that the document isnt closed. Also when i try to view the original document it says i can view it read only.

Can someone please help me on how to completely close and Save the document.

Thanks
 
try:
Code:
msword.quit
i think docs in msword just close only and leave them locked if you dont close ms word completely by quitting the app
 

Users who are viewing this thread

Back
Top Bottom