Sunday, March 29, 2009

MOTD: Insert Merge Field

I've posted before about the amazing potential of Word's Mail Merge feature, I use it so much that I've created a macro to insert MergeFields when I'm creating a merge document. I then assign the macro to a shortcut so I can quickly insert these fields in my documents. I simply recorded a macro without editing any code so you can record it yourself using this post and this post, or you can put the following code in the Normal template and assign a shortcut to it (use this post):

Sub InsertMergeField() 'ALT CTRL M
'
' InsertMergeField Macro
' Macro recorded 3/13/2009 by Michael Shubeck
'
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"MERGEFIELD INSERT ", PreserveFormatting:=True
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.Fields.ToggleShowCodes
End Sub

0 comments:

Post a Comment