1. What does it actually do? Do you see an error message?
2. Can you copy the text of the macro into a message in this thread please?
Peter Jamieson
Hi,
Thanks for that, I've added the ' .Execute', statement at the end of
the script but, unfortunately, I get the same result.
I assume it is to go at the end?
Peter Jamieson wrote:
There's no error message, it simply still displays the «Next
Record»«AddressBlock» message as previous.
Ive pasted the script below.
Sub Merge()
'
' Merge Macro
Application.MailingLabel.DefaultPrintBarCode = False
Application.MailingLabel.CreateNewDocument Name:="AOne 28171",
Address:="", AutoText:="ToolsCreateLabels3",
LaserTray:=wdPrinterTractorFeed, _
ExtractAddress:=False, PrintEPostageLabel:=False, Vertical:=False
ActiveDocument.MailMerge.MainDocumentType = wdMailingLabels
ActiveDocument.MailMerge.OpenDataSource Name:="C:\test.csv", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True,
_
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="",
Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="", SQLStatement:="",
SQLStatement1 _
:="", SubType:=wdMergeSubTypeOther
ActiveDocument.Fields.Add Range:=Selection.Range, Type:= _
wdFieldAddressBlock, Text:= _
"\f ""<<_TITLE0_ >><<_FIRST0_>><< _LAST0_>><< _SUFFIX0_>>" &
Chr(13) & "<<_COMPANY_," & Chr(13) & ">><<_STREET1_" & Chr(13) &
">><<_STREET2_" & Chr(13) & ">><<_CITY_" & Chr(13) & ">><<_STATE_" &
Chr(13) & ">><<_POSTAL_>><<" & Chr(13) & "_COUNTRY_>>"" \l 2057 \c 2 \e
""U"
WordBasic.ActiveDocument.MailMergePropagateLabel
ActiveDocument.MailMerge.Execute
End Sub
Thanks for all your help.
Regards.
> 1. What does it actually do? Do you see an error message?
>
[quoted text clipped - 56 lines]
> >
> > Cheers.
Peter Jamieson - 02 Aug 2006 17:14 GMT
1. Do the <<Next Record>><<Addressblock>> fields propagate successfully? If
not, are you using a tablet PC?
2. if you enable the MailMerge Toolbar (e.g. using
Tools|Customize|Toolbars), after all the propagates have been done, are the
icons after the first two icons in the toolbar greyed out? If so, you may
need to set a registry item as described in the following article:
http://support.microsoft.com/default.aspx?scid=kb;en-us;825765
If not, can you create a macro with /just/ the following lines and see what
happens when you run it:
Sub testexec()
ActiveDocument.MailMerge.Destination = wdSendToNewDocument
ActiveDocument.MailMerge.Execute
End Sub
(NB I think I got the name of "wdSendToPrinter" wrong before)
Peter Jamieson
There's no error message, it simply still displays the «Next
Record»«AddressBlock» message as previous.
Ive pasted the script below.
Sub Merge()
'
' Merge Macro
Application.MailingLabel.DefaultPrintBarCode = False
Application.MailingLabel.CreateNewDocument Name:="AOne 28171",
Address:="", AutoText:="ToolsCreateLabels3",
LaserTray:=wdPrinterTractorFeed, _
ExtractAddress:=False, PrintEPostageLabel:=False, Vertical:=False
ActiveDocument.MailMerge.MainDocumentType = wdMailingLabels
ActiveDocument.MailMerge.OpenDataSource Name:="C:\test.csv", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True,
_
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="",
Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="", SQLStatement:="",
SQLStatement1 _
:="", SubType:=wdMergeSubTypeOther
ActiveDocument.Fields.Add Range:=Selection.Range, Type:= _
wdFieldAddressBlock, Text:= _
"\f ""<<_TITLE0_ >><<_FIRST0_>><< _LAST0_>><< _SUFFIX0_>>" &
Chr(13) & "<<_COMPANY_," & Chr(13) & ">><<_STREET1_" & Chr(13) &
">><<_STREET2_" & Chr(13) & ">><<_CITY_" & Chr(13) & ">><<_STATE_" &
Chr(13) & ">><<_POSTAL_>><<" & Chr(13) & "_COUNTRY_>>"" \l 2057 \c 2 \e
""U"
WordBasic.ActiveDocument.MailMergePropagateLabel
ActiveDocument.MailMerge.Execute
End Sub
Thanks for all your help.
Regards.
Peter Jamieson wrote:
> 1. What does it actually do? Do you see an error message?
>
[quoted text clipped - 59 lines]
> >
> > Cheers.
The Blues - 03 Aug 2006 17:22 GMT
Hi,
Ive found the problem, I had omitted to insert headers into the source
document csv file so the macro couldnt identify what to transfer onto
the label.
Thanks for all your help anyway, it was much appreciated.
Regards.
> 1. Do the <<Next Record>><<Addressblock>> fields propagate successfully? If
> not, are you using a tablet PC?
[quoted text clipped - 124 lines]
> > >
> > > Cheers.