Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Word Doc from Access 1

Status
Not open for further replies.

gwilym40

Programmer
May 2, 2002
31
GB
Hi

After using an application.followhyperlink to take someone to a word document, can you print out that word document automatically from access?

regards
 
Hi

Yes you can. there will be several ways to do it, but i can only give you one way.

However, you need the following:
1. WORD to be installed on the machine in question
2. The relevant references added subject to the version of Word you are using. e.g. Microsoft Word 8.0 Object Library for version 97 (I think)

Dim wordApp As Word.Application
Dim wordDoc As Word.Document

Set wordApp = CreateObject("Word.Application")

wordApp.Documents.Open ("c:\MyPath\MyFile.Doc")

With wordApp.ActiveDocument
.PrintOut
.Close
End With

wordApp.Quit

Set wordApp = Nothing
 
p.s.

You will get a dialog that advises that you are quitting Word before the document has had a chance to print. For now, select No. I have posted a question in the forum (VBA) to try to find a way of detecting / waiting until a document has been sent to the printer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top