Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA printing to MS Word cause MS Word to crash, why?


I have an excel file that I use to print 4 documents for each lin
(5000) in the Excel worksheet.

This entire action is automated via VBA code. The first two document
printed are Excel worksheet documents, the 3rd is an MS Word file, an
the 4th is an Excel worksheet document.

I wrote the initial application is Office 2002 and it works fine i
2002. I am now required to make it work in Office 2000, but crashes M
Word in Office 2000.

The MS Word document contains field codes that are updated fro
specific cells in the Excel Worksheet. MS Word Print Options are se
to Update Links, Update Field codes, and no background printing.

The first 6 Excel lines process fine beofe MS Word crashes. I receiv
a message "MS Word for Windows has encountered a problem and needs t
close:" The Error code is:

AppName: winword.exe AppVer: 9.0.0.3822 Offset: 000f3a53.

Excel has a window open indicating that "Microsoft Excel is waiting fo
another application to complete an OLE object". Click "Send" or Don'
Send" in the MS Word error closes Word, and Excel then produces
run-time error '-2147023170 (800706be)' Automation error The remot
procedure call failed.

The debug line reads as follows:

wdApp.activedocument.PrintOut Background:=False, Copies:=1
Collate:=True


My entire Excel vba word code looks like this:

Dim wdApp As Object
Dim wdDoc As Object

Set wdApp = CreateObject("Word.Application")
Set wdDoc = wdApp.documents.Open("C:\FormR1.doc")

Do Until Worksheets("DB").Cells(i, 1).Value = ""

Worksheets("AddrSheet").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

Worksheets("Cover").Activate
Application.CalculateFull
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

wdApp.activedocument.PrintOut Background:=False, Copies:=1
Collate:=True
Worksheets("FormA").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

i = i + 1
Loop


Any ideas why this crashes

--
alruf
-----------------------------------------------------------------------
alruff's Profile: http://www.excelforum.com/member.php...fo&userid=1500
View this thread: http://www.excelforum.com/showthread.php?threadid=26623

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
Word and Excel crash when I try to open a folder to get to a file DGD41 Excel Discussion (Misc queries) 7 April 15th 06 09:14 PM
excel and word crash Ijaz Excel Worksheet Functions 1 April 15th 06 04:35 AM
Embedding Word Docs into Excel Worksheets and Then Printing The Word Docs mr_melvis Excel Worksheet Functions 1 April 8th 05 03:00 AM
Printing Word Document using Excel Programming hangs Word Alan Excel Programming 0 September 30th 04 08:41 PM
Printing Word doc from Excel Ed Stevens[_2_] Excel Programming 1 October 17th 03 02:15 PM


All times are GMT +1. The time now is 06:47 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"