get file name from a Word template

  • Thread starter Thread starter HS1
  • Start date Start date
H

HS1

Hello all


In a Access form, I have a button that can open a Word template (letter).
The word template will use the information such as name and address from a
record in presenting table.

----------
Private Sub Letter_Click()

'Start Microsoft Word 97.
Set objWord = CreateObject("Word.Application")

With objWord
'Make the application visible.
.Visible = True

'Open the document.
.Documents.Open ("C:\WINDOWS\Mydocument\LetterTemp.doc")
.......
.......
.......

-----------------------------

Now I want to save this letter. I can click "Save as" in this Word document
and then input the Name of the file and the folder for this file, click
Save.

Could you please tell me how I can get the string of this Name and location
of this file so that I can save it as a Hyerlink into a table. This helps me
to find the file easily.


Thank you
SH1
 
Assign the document to a WithEvents variable, ie
Private WithEvents doc As Word.Document
.....
Set MyDoc = .Documents.Open ("C:\WINDOWS\Mydocument\LetterTemp.doc")

and handle its Close event.

Private Sub doc_Close()
DoSomethingWith doc.FullName
set doc = nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top