|
Subject:
|
Print Word document from Access Form
|
|
Posted By:
|
ppenn
|
Post Date:
|
12/14/2005 5:38:42 AM
|
Hi I am trying to print a Word document from within an Access 2000 application form. I am using the following code:
Private Sub Command2_Click()
Dim wrd As Word.Application
Set wrd = Word.Application wrd.Visible = True wrd.Documents.Open Filename:="Q:\Example.doc" wrd.ActiveDocument.PrintOut Do While wrd.BackgroundPrintingStatus <> 0 DoEvents 'Let Word print the document Loop wrd.Quit
End Sub
But when I attempt to run it I get the following error:
"ActiveX component can't create object"
Can anyone suggest what I am doing wrong Many thanks in advance
Peter
|
|
Reply By:
|
leehambly
|
Reply Date:
|
12/14/2005 6:19:21 AM
|
Works fine for me... on MS Access 2003.
Have you added the Reference for Word? Only thing I can think of which may cause an issue with this.
|
|
Reply By:
|
ppenn
|
Reply Date:
|
12/14/2005 6:51:42 AM
|
Hi Thanks for your reply I have now found that if I have word open it will work Any ideas why that should be? Regards
|