View Single Post
 
Old 03-29-2018, 02:30 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by amenu View Post
To ensure her acceptance of a process that she has never used I wanted to come up with a one-click solution by recording a macro.

It turns out that the recorded macro does not work when run in an empty document. It produces one merged label per page instead of the 30 labels per page that the labels template calls for.

I would be interested in learning why.
At best, a macro will save just two mouse clicks in this case - one to answer 'Yes' to the SQL prompt, the other to choose the destination (e.g. printer vs new document). The macro also wouldn't let the user choose which records to process if only a few labels were required.

The reason your macro doesn't work as expected is that it lacks any code to tell Word that it's a label merge. Furthermore, you're adding a single mergefield to the document and are not propagating that to all the labels. It also seems clear to me that you're not actually starting off with an empty document - it already has the empty labels in place. Had you populated the labels manually (again, a once-off exercise), there'd be no need for your code to add any mergefields or to propagate them to all the labels.

The last thing to note is that, if your user was to save the document after running your macro, it would now be a mailmerge main document and would thus generate the SQL prompt next time the document is opened...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote