print problem after merge

M

Mike Molyneaux

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
 
D

Doug Robbins

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.

--
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top