Quote:
|
quote:Is there anyway I can print the document without shelling out to Word.
|
You can use Automation instead. In Access, set a reference to the Microsoft Word x.0 Object Library. Then place the following in your command button's click event:
Private Sub cmdPrintWordDoc_Click()
' SET REFERENCE: Microsoft Word x.0 Object Library
Dim wordApp As Word.Application
Dim wordDoc As Word.Document
Set wordApp = CreateObject("Word.Application")
Set wordDoc = wordApp.Documents.Open("C:\Test.doc")
wordApp.Visible = False
wordDoc.PrintOut Background:=False
' Quit Word.
wordApp.Quit
Set wordApp = Nothing
End Sub
Quote:
|
quote:is there a way I can select the printer
|
When the file prints, you can invoke the MSWord Print File Dialog via VBA code in the Word document's code module. Open the Word document in Word and press F11 to open the VBA Editor. Add the following code:
Private Sub Document_Open()
Dialogs(wdDialogFilePrint).Show
End Sub
The code in the Word VBA module will only execute when the Document object's PrintOut method is called from Access, i.e. the Print File Dialog won't show if you simply open the document in an instance of Word.
HTH,
Bob