There is no code in your macro to change printers?
I have tested your code (changing only the templatename and the data file)
and it works here without pause straight to the default printer.
Strip out some of the extra stuff the recorder adds and then you get the
following to which (as this appears to be a label merge), the appropriate
document type and the propagation to the other labels of the inserted data
has been added.
Documents.Add Template:= "F:\Templates\Label 4x2.dot"
Selection.Font.Size = 36
Selection.Font.Bold = True
With ActiveDocument.MailMerge
.MainDocumentType = wdMailingLabels
.OpenDataSource Name:= "Z:\Data\let.txt"
.EditMainDocument
.Fields.Add Range:=Selection.Range, Name:="First"
WordBasic.MailMergePropagateLabel
.Destination = wdSendToPrinter
.SuppressBlankLines = True
.Execute
End With
As for having further thoughts, I am undoubtedly in a different time zone to
you (Eastern Europe), hence I may not respond when you expect. The regular
contributors here will jump in if they have anything to offer - but for
myself, I am fast running out of ideas. I would suggest that you look at
your template to see what is happening there, and to your printer
properties - for the macro works. This macro (now) puts the firstname field
from the data file into a table (the template), formats that field as 36
point bold and (now copies that field to all the other cells before) it
merges to the ActivePrinter. If you want to know how to change the active
printer, see
http://www.gmayor.com/fax_from_word.htm
Hi Graham,
Here is the code that I am using:
Sub NameTagsFirst()
'
' NameTagsFirst Macro
' Macro created 5/30/2002 by Kenneth Sole
'
'
Documents.Add Template:= _
"F:\Templates\Label 4x2.dot" _
, NewTemplate:=False, DocumentType:=0
With ActiveDocument.PageSetup
.TopMargin = InchesToPoints(0.7)
End With
Documents.Open FileName:="Z:\Data\let.txt",
ConfirmConversions:=False, ReadOnly:= _
False, AddToRecentFiles:=False,
PasswordDocument:="", PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="",
WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto
Selection.TypeText Text:="First" & vbTab
Selection.TypeParagraph
ActiveDocument.Save
ActiveWindow.Close
Selection.Font.Size = 36
Selection.Font.Bold = wdToggle
ActiveDocument.MailMerge.MainDocumentType =
wdFormLetters
ActiveDocument.MailMerge.OpenDataSource
Name:="Z:\data\let.txt", _
ConfirmConversions:=False, ReadOnly:=False,
LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="",
WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="",
SQLStatement:="", SQLStatement1 _
:=""
ActiveDocument.MailMerge.EditMainDocument
ActiveDocument.MailMerge.Fields.Add
Range:=Selection.Range, Name:="First"
ActivePrinter = "OKI"
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
ActivePrinter = "HP Color LaserJet 2500 PCL 6"
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Application.ScreenUpdating = True
Application.Quit
End Sub
It sets the active printer to "OKI" and then at the end,
sets back to a sheet printer.
I will certainly experiment with the stripped down code you
suggest, and as before, offer my sincere thanks,