Opening and closing a word doc.

J

jokobe

I am opening a word doc from a access form. How can I manage to close that
word doc from access too?


Jokobe
 
O

Ofer

Try

Function Open_WordDoc()

Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim DocPath As String

DocPath = "c:\DocNames.doc"

Set objWord = New Word.Application
Set objDoc = objWord.Documents.Open(DocPath)

objDoc.Activate
objDoc.PrintOut ' To print out
objWord.Visible = True ' To display
objWord.Quit ' To close
End Function
 
J

jokobe

The trouble is here:
Set objDoc = objWord.Documents.Open(DocPath)
I open the doc with a simiple link (the user clicks on the link, word opens
with the document).

When trying to close with objword.documents.close the is no
argument for the document name.
 
Top