Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
There's an option in MSWord that you can turn off.
Tools|Options|print tab|uncheck background printing Then word will wait until the print job finishes. A longggg time ago, (word95???), background printing caused trouble printing tables or shapes or something. As a habit, I always turn this option off. (Although, newer versions of MSWord may have been fixed.) In code, you could do something like: Option Explicit Sub Testme() Dim WDApp As Object Dim WDDoc As Object Dim myDocName As String Dim myPrintBackground As Boolean myDocName = "c:\my documents\word\doc2.doc" Set WDApp = CreateObject("Word.Application") WDApp.Visible = True 'at least for testing! Set WDDoc = WDApp.documents.Open(Filename:=myDocName) myPrintBackground = WDApp.Options.printbackground WDApp.Options.printbackground = False WDDoc.PrintOut WDApp.Options.printbackground = myPrintBackground WDDoc.Close savechanges:=False WDApp.Quit Set WDDoc = Nothing Set WDApp = Nothing End Sub If you step through the code, you should see a slight delay while the wdapp.quit is finishing up. BruceInMiami wrote: I found the answer in a 7/19/05 reply by Henry. I guess my problem was not the wrdApp.PrintOut code, but that I needed to give Word time to print it before closing it: wrdApp.PrintOut Application.Wait Time + TimeValue("00:00:05") If anyone has any further comments or clarifications I would appreciate it. Thanks, Bruce "BruceInMiami" wrote: Thanks to John Walkenbach's Excel 2003 Power Programming, I can populate a Word template with Excel data and save the doc file, but I can't figure out the code to print the document so that I don't have to reopen it. Can anyone help? Thanks, Bruce -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Embedding Word Docs into Excel Worksheets and Then Printing The Word Docs | Excel Worksheet Functions | |||
Printing MS Word Doc From MS Excel | Excel Discussion (Misc queries) | |||
Excel VBA printing to MS Word cause MS Word to crash, why? | Excel Programming | |||
Printing Word Document using Excel Programming hangs Word | Excel Programming | |||
Excel code to Wait until Word finishes printing before closing | Excel Programming |