Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Printing Word Document using Excel Programming hangs Word

I have an Excel spreadsheet that prints an MS Word
document with field code links back to values in the
Excel Spreadsheet.

Basically I cycle through all the rows in the Excel
spreadsheet and print the Word Document for each line in
the Excel file.

I built the application using Windows XP, and Office XP
2002--works fine. I have tried running it on a PC
running Windows XP, and Office 2000. The Word document
printing hangs without a 3-second wait. At the end it
will not end properly, and prompts the user that "Ending
Word will stop the print jobs (2 print jobs left are
left)".

Any idea how to overcome this? Below is the basic code I
am using:

Dim wdApp As Object
Set wdApp = CreateObject("Word.Application")
Set wdDoc = wdApp.documents.Open
("C:\fldr\Templates\FormR1.dot")

Do until eof
wdApp.activedocument.PrintOut Background:=True,
Copies:=1, Collate:=True

*** This section of code will not work in Word 2000 ***
' lngstatus = 1 'wdApp.BackgroundPrintingStatus
' Do Until lngstatus = 0
' lngstatus = wdApp.BackgroundPrintingStatus
' Loop
*** This is the workaround with a wait included ***
newhour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now())
waitTime = TimeSerial(newhour,newMinute,newSecond)
Application.Wait waitTime
Loop
*** Hangs on the following line, even with a wait added
***
wdApp.activedocument.Close
wordfile = wdApp.Quit


Thanks for your help!!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel VBA Programming: Word Document Compare? Keri B Excel Discussion (Misc queries) 0 January 19th 10 05:12 PM
Excel - Printing a page that contains an Embedded Word Document JLMHoss Excel Discussion (Misc queries) 2 July 22nd 08 09:56 PM
Problems printing a word document with linked excel tables. jcarlos Excel Discussion (Misc queries) 0 August 30th 05 04:01 PM
Printing a Word document from an excel macro Mike_Shimandle Excel Programming 1 September 30th 04 04:13 PM
Printing a Word document from an excel macro mshimandle Excel Programming 0 September 30th 04 04:07 PM


All times are GMT +1. The time now is 02:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"