#1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
The Blues The Blues is offline
external usenet poster
 
Posts: 4
Default Auto Mail Merge

Hi,

Ive recorded a macro to mail merge data from excel. When the macro is
run it only gets as far as the end of step 4, and displays the
following on the labels -

«Next Record»«AddressBlock»

It doesnt complete step 5 "Preview Labels" or step 6 "Complete the
merge"

Any ideas ??

Cheers.

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Auto Mail Merge

Something to bear in mind is that the macro recorder does not record
something that will necessarily replay every step you took in Word. Some
actions in Word do not have equivalent VBA commands and they don't get
recorded.

Open the VBA editor and have a look at the macro you recorded.

I haven't checked, but the chances are that it has a lot of stuff that
a. sets up the merge type and merge data source
b. sets up the label layout and fields

Typically you don't need either (a) or (b) once you have already done it -
what you need to do is save the mail merge main document you have created -
when you re-open it, all that stuff will still be there. The merge
destination (printer or new document) can be saved in there too.

What you probably will not see in the macro is a statement like

ActiveDocument.MailMerge.Execute

and that's the statment you need to add in order to get the labels to merge
(either to printer or a new document).

If you need to set the destination, set e.g.

ActiveDocument.MailMerge.Destination = wdMergeToPrinter

or whatever.

Peter Jamieson

"The Blues" wrote in message
ups.com...
Hi,

Ive recorded a macro to mail merge data from excel. When the macro is
run it only gets as far as the end of step 4, and displays the
following on the labels -

«Next Record»«AddressBlock»

It doesnt complete step 5 "Preview Labels" or step 6 "Complete the
merge"

Any ideas ??

Cheers.


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
The Blues The Blues is offline
external usenet poster
 
Posts: 4
Default Auto Mail Merge

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:
Something to bear in mind is that the macro recorder does not record
something that will necessarily replay every step you took in Word. Some
actions in Word do not have equivalent VBA commands and they don't get
recorded.

Open the VBA editor and have a look at the macro you recorded.

I haven't checked, but the chances are that it has a lot of stuff that
a. sets up the merge type and merge data source
b. sets up the label layout and fields

Typically you don't need either (a) or (b) once you have already done it -
what you need to do is save the mail merge main document you have created -
when you re-open it, all that stuff will still be there. The merge
destination (printer or new document) can be saved in there too.

What you probably will not see in the macro is a statement like

ActiveDocument.MailMerge.Execute

and that's the statment you need to add in order to get the labels to merge
(either to printer or a new document).

If you need to set the destination, set e.g.

ActiveDocument.MailMerge.Destination = wdMergeToPrinter

or whatever.

Peter Jamieson

"The Blues" wrote in message
ups.com...
Hi,

Ive recorded a macro to mail merge data from excel. When the macro is
run it only gets as far as the end of step 4, and displays the
following on the labels -

«Next Record»«AddressBlock»

It doesnt complete step 5 "Preview Labels" or step 6 "Complete the
merge"

Any ideas ??

Cheers.


  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Auto Mail Merge

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
"The Blues" wrote in message
ups.com...
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:
Something to bear in mind is that the macro recorder does not record
something that will necessarily replay every step you took in Word. Some
actions in Word do not have equivalent VBA commands and they don't get
recorded.

Open the VBA editor and have a look at the macro you recorded.

I haven't checked, but the chances are that it has a lot of stuff that
a. sets up the merge type and merge data source
b. sets up the label layout and fields

Typically you don't need either (a) or (b) once you have already done it -
what you need to do is save the mail merge main document you have
created -
when you re-open it, all that stuff will still be there. The merge
destination (printer or new document) can be saved in there too.

What you probably will not see in the macro is a statement like

ActiveDocument.MailMerge.Execute

and that's the statment you need to add in order to get the labels to
merge
(either to printer or a new document).

If you need to set the destination, set e.g.

ActiveDocument.MailMerge.Destination = wdMergeToPrinter

or whatever.

Peter Jamieson

"The Blues" wrote in message
ups.com...
Hi,

Ive recorded a macro to mail merge data from excel. When the macro is
run it only gets as far as the end of step 4, and displays the
following on the labels -

«Next Record»«AddressBlock»

It doesnt complete step 5 "Preview Labels" or step 6 "Complete the
merge"

Any ideas ??

Cheers.



  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
The Blues The Blues is offline
external usenet poster
 
Posts: 4
Default Auto Mail Merge

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?

2. Can you copy the text of the macro into a message in this thread please?

Peter Jamieson
"The Blues" wrote in message
ups.com...
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:
Something to bear in mind is that the macro recorder does not record
something that will necessarily replay every step you took in Word. Some
actions in Word do not have equivalent VBA commands and they don't get
recorded.

Open the VBA editor and have a look at the macro you recorded.

I haven't checked, but the chances are that it has a lot of stuff that
a. sets up the merge type and merge data source
b. sets up the label layout and fields

Typically you don't need either (a) or (b) once you have already done it -
what you need to do is save the mail merge main document you have
created -
when you re-open it, all that stuff will still be there. The merge
destination (printer or new document) can be saved in there too.

What you probably will not see in the macro is a statement like

ActiveDocument.MailMerge.Execute

and that's the statment you need to add in order to get the labels to
merge
(either to printer or a new document).

If you need to set the destination, set e.g.

ActiveDocument.MailMerge.Destination = wdMergeToPrinter

or whatever.

Peter Jamieson

"The Blues" wrote in message
ups.com...
Hi,

Ive recorded a macro to mail merge data from excel. When the macro is
run it only gets as far as the end of step 4, and displays the
following on the labels -

«Next Record»«AddressBlock»

It doesnt complete step 5 "Preview Labels" or step 6 "Complete the
merge"

Any ideas ??

Cheers.




  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Auto Mail Merge

1. Do the Next RecordAddressblock 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...b;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


"The Blues" wrote in message
ups.com...
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?

2. Can you copy the text of the macro into a message in this thread
please?

Peter Jamieson
"The Blues" wrote in message
ups.com...
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:
Something to bear in mind is that the macro recorder does not record
something that will necessarily replay every step you took in Word. Some
actions in Word do not have equivalent VBA commands and they don't get
recorded.

Open the VBA editor and have a look at the macro you recorded.

I haven't checked, but the chances are that it has a lot of stuff that
a. sets up the merge type and merge data source
b. sets up the label layout and fields

Typically you don't need either (a) or (b) once you have already done
it -
what you need to do is save the mail merge main document you have
created -
when you re-open it, all that stuff will still be there. The merge
destination (printer or new document) can be saved in there too.

What you probably will not see in the macro is a statement like

ActiveDocument.MailMerge.Execute

and that's the statment you need to add in order to get the labels to
merge
(either to printer or a new document).

If you need to set the destination, set e.g.

ActiveDocument.MailMerge.Destination = wdMergeToPrinter

or whatever.

Peter Jamieson

"The Blues" wrote in message
ups.com...
Hi,

Ive recorded a macro to mail merge data from excel. When the macro is
run it only gets as far as the end of step 4, and displays the
following on the labels -

«Next Record»«AddressBlock»

It doesnt complete step 5 "Preview Labels" or step 6 "Complete the
merge"

Any ideas ??

Cheers.



  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields
The Blues The Blues is offline
external usenet poster
 
Posts: 4
Default Auto Mail Merge

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.


Peter Jamieson wrote:
1. Do the Next RecordAddressblock 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...b;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


"The Blues" wrote in message
ups.com...
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?

2. Can you copy the text of the macro into a message in this thread
please?

Peter Jamieson
"The Blues" wrote in message
ups.com...
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:
Something to bear in mind is that the macro recorder does not record
something that will necessarily replay every step you took in Word. Some
actions in Word do not have equivalent VBA commands and they don't get
recorded.

Open the VBA editor and have a look at the macro you recorded.

I haven't checked, but the chances are that it has a lot of stuff that
a. sets up the merge type and merge data source
b. sets up the label layout and fields

Typically you don't need either (a) or (b) once you have already done
it -
what you need to do is save the mail merge main document you have
created -
when you re-open it, all that stuff will still be there. The merge
destination (printer or new document) can be saved in there too.

What you probably will not see in the macro is a statement like

ActiveDocument.MailMerge.Execute

and that's the statment you need to add in order to get the labels to
merge
(either to printer or a new document).

If you need to set the destination, set e.g.

ActiveDocument.MailMerge.Destination = wdMergeToPrinter

or whatever.

Peter Jamieson

"The Blues" wrote in message
ups.com...
Hi,

Ive recorded a macro to mail merge data from excel. When the macro is
run it only gets as far as the end of step 4, and displays the
following on the labels -

«Next Record»«AddressBlock»

It doesnt complete step 5 "Preview Labels" or step 6 "Complete the
merge"

Any ideas ??

Cheers.


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge can't find data source in Office XP...but it could in 2000! [email protected] Mailmerge 4 June 7th 06 03:15 PM
Adding a field to an Off 97 mail merge using Office Pro 2003 TomC Mailmerge 1 January 5th 06 08:00 AM
Use VBA to auto open Mail Merge Recipients on opening doc Nucleo Mailmerge 2 August 18th 05 11:03 AM
Problem with automating mail merge HeatherO Mailmerge 2 March 29th 05 10:11 PM
Using Hyperlinks in Mail Merge IF...THEN...ELSE Statements Mark V Mailmerge 8 November 30th 04 01:31 PM


All times are GMT +1. The time now is 08:38 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"