Office 2003, Xp Pro SP1.
User has macro to merge data to document, then print same.
Works fine.
Cannot then print from Excel unless restart computer.
Excel creates file named some number of squares with no
file size.
Here's macro:
Sub mergeLabels()
Application.ScreenUpdating = False
Application.DisplayAlerts = wdAlertsNone
Documents.Open FileName:= _
"""n:\file transfers\payroll\master 2 by 20
labels.doc""", _
ConfirmConversions:=False, _
ReadOnly:=False, _
AddToRecentFiles:=False, _
PasswordDocument:="", _
PasswordTemplate:="", _
Revert:=False, _
WritePasswordDocument:="", _
WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto
ActiveDocument.MailMerge.OpenDataSource Name:= _
"N:\File Transfers\Payroll\nprf0432.dat", _
ConfirmConversions:=False, _
ReadOnly:=False, _
LinkToSource:=True, _
AddToRecentFiles:=False, _
PasswordDocument:="", _
PasswordTemplate:="", _
WritePasswordDocument:="", _
WritePasswordTemplate:="", _
Revert:=False, _
Format:=wdOpenFormatAuto, _
Connection:="", _
SQLStatement:="", _
SQLStatement1:="", _
SubType:= _
wdMergeSubTypeOther
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
ActiveDocument.SaveAs FileName:= _
"""n:\file transfers\payroll\print 2 by 20
labels.doc""", _
FileFormat:=wdFormatDocument, _
LockComments:=False, _
Password:="", _
AddToRecentFiles:=True, _
WritePassword:="", _
ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, _
SaveFormsData:=False, _
SaveAsAOCELetter:=False
Application.PrintOut FileName:="", _
Range:=wdPrintAllDocument, _
Item:=wdPrintDocumentContent, _
Copies:=1, Pages:="", _
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, _
Collate:=True, Background:=True, _
PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, _
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
ActiveDocument.Save
ActiveDocument.Close
ActiveDocument.Save
ActiveDocument.Close
Application.ScreenUpdating = True
Application.DisplayAlerts = wdAlertsAll
End Sub
Am I missing a command or something?
Thanks - Mike
Doug Robbins - 22 Sep 2004 00:03 GMT
Try:
ActiveDocument.PrintOut Background:=False
in place of:
Application.PrintOut FileName:="", _
Range:=wdPrintAllDocument, _
Item:=wdPrintDocumentContent, _
Copies:=1, Pages:="", _
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, _
Collate:=True, Background:=True, _
PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, _
PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
I think that there might be a timing issue that setting the Background
parameter to false may prevent as the balance of the code will not then run
until the print job is finished.

Signature
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.
Hope this helps,
Doug Robbins - Word MVP
> Office 2003, Xp Pro SP1.
>
[quoted text clipped - 95 lines]
>
> Thanks - Mike
this change did not fix the problem - thanks anyway
>-----Original Message-----
>Try:
[quoted text clipped - 18 lines]
>parameter to false may prevent as the balance of the code will not then run
>until the print job is finished.