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