View Single Post
 
Old 06-14-2010, 07:58 AM
Kimberly Kimberly is offline Windows 7 Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Posts: 517
Kimberly is on a distinguished road
Default

"(ActiveDocument.MailMerge.ViewMailMergeFieldC odes = wdToggle) which should merge the data into the document."
No, it shouldn't. Again, the ABC button does not perform a merge. It only previews. I don't know why that is giving you an error though, but it isn't supposed to merge.

I am not clear... is it true that you have templates that contain merge fields and you want to create a macro that creates a new doc based on the dot and then completes the merge to a new doc?
If so, I would expect your macro to resemble:
Code:
Sub NewDocAndMerge()
'
' NewDocAndMerge Macro
' Macro recorded 6/14/2010 by kimberly
'
    Documents.Add Template:= _
        "C:\Documents and Settings\Administrator\Application Data\Microsoft\Templates\mergetest.dot" _
        , NewTemplate:=False, DocumentType:=0
    With ActiveDocument.MailMerge
        .Destination = wdSendToNewDocument
        .SuppressBlankLines = True
        With .DataSource
            .FirstRecord = wdDefaultFirstRecord
            .LastRecord = wdDefaultLastRecord
        End With
        .Execute Pause:=False
    End With
End Sub
Reply With Quote