Help -- Background Print Word file using automation fails 
Author Message
 Help -- Background Print Word file using automation fails

My function has the following code:

Sub PrintDocument()
    Dim wrd As New Word.Application

    Set wrd = Word.Application
    wrd.Visible = True    ' Not necessary
    wrd.Documents.Open Filename:="C:\Lease2K\Lease2K.DOC"
    wrd.ActiveDocument.PrintOut
    Do While wrd.BackgroundPrintingStatus <> 0
        DoEvents    ' Let Word print the document
    Loop
    wrd.Quit
End Sub

The line Set wrd = Word.Application fails and Access reports the following:

ActiveX component can't create object or return reference to this object
(Error 429)

and the help file reports this introductory line ... Creating objects
requires that the object's class be registered in the system registry and
that any associated dynamic-link libraries (DLL) be available. This error
has the following causes and solutions: ....

Microsoft Word Object 8.0 Library is checked in Access' Tools/References
list.

I'm running Win 98 and OfficePro-SR2, full installs of each.

Any one have any idea what I need to do?

Thanks -- Ken



Thu, 08 Nov 2001 03:00:00 GMT  
 Help -- Background Print Word file using automation fails
Hi Ken,

  Once you've instantiated a new Word application object through the New
keyword, you don't need another Set statement.  VBA doesn't create the
object right away when you declare the variable using the New keyword, but
it will automatically load the server when it comes across a line of code
which references the server, in your case, wrd.visible=True.

  Either try removing the Set statement in your code, or to be more explicit
in your code, try something like this

  DIm wrd as Word.Application
  set wrd=New Word.Application

Also, since you basically want to wait till the print job has finished, why
not disable the background print option?  I think Printout method has an
optional param

  wrd.ActiveDocument.Print Background:=False

 or close to it.

 HTH
 -- Dev

Quote:

>My function has the following code:

>Sub PrintDocument()
>    Dim wrd As New Word.Application

>    Set wrd = Word.Application
>    wrd.Visible = True    ' Not necessary
>    wrd.Documents.Open Filename:="C:\Lease2K\Lease2K.DOC"
>    wrd.ActiveDocument.PrintOut
>    Do While wrd.BackgroundPrintingStatus <> 0
>        DoEvents    ' Let Word print the document
>    Loop
>    wrd.Quit
>End Sub

>The line Set wrd = Word.Application fails and Access reports the following:

>ActiveX component can't create object or return reference to this object
>(Error 429)

>and the help file reports this introductory line ... Creating objects
>requires that the object's class be registered in the system registry and
>that any associated dynamic-link libraries (DLL) be available. This error
>has the following causes and solutions: ....

>Microsoft Word Object 8.0 Library is checked in Access' Tools/References
>list.

>I'm running Win 98 and OfficePro-SR2, full installs of each.

>Any one have any idea what I need to do?

>Thanks -- Ken



Fri, 09 Nov 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Using VBA Automation to Open Word at the File Open Locatiion

2. Extracting images to file from Word using VB automation

3. Word Automation fails due to Outlook conflict

4. VB6 Automation of Word 2002 fails after applying SP-2 update

5. Word OLE automation fails

6. Help please using Word automation

7. Help - Printing access report using automation

8. printing to file using word object.

9. Printing word document fails...

10. How to view the files printed by VB using print to file

11. Help - Print - Help -Print - Help - Print - Help - Print - Help

12. Print formatting problems -- Using VBA in Access 2000 to print a doc in Word

 

 
Powered by phpBB® Forum Software