Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 14th, 2005, 06:38 AM
ppenn
Guest
 
Posts: n/a
Default Print Word document from Access Form

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
 
Old December 14th, 2005, 07:19 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to leehambly
Default

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.
 
Old December 14th, 2005, 07:51 AM
ppenn
Guest
 
Posts: n/a
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to print ms word document from command prompt? priya7.priya C# 0 October 4th, 2007 08:24 AM
Create and Save ASP form Contents to Word Document abhisheksud Classic ASP Professional 1 October 13th, 2005 04:00 AM
display word document in form collie VB.NET 2002/2003 Basics 1 September 12th, 2004 09:53 PM
Access 97 and opening a Word document Andrew Antoniak Access VBA 1 June 11th, 2004 12:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.