View Single Post
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
AndrewC
 
Posts: n/a
Default MailMerge Through VBA Printing Actual Field Names NOT Field Values

Hello.

I hopefully have a quick question on VBA.

I am automating a merge process. However I created a few documents
that link are already setup and linked to their data sources.

I also have a blank document that I am using to run a VBA form. When
the document is open the VBA form is open. One function of the form is
to print all the documents in a specific directory - these are the
documents previously linked to a specific data source file.

All the VBA code must do is open the document and print the merged data
source. I'd like it to merge to a new document and then print. Any
dialogue boxes should be suppressed and the document should be closed
after it is sent to the print queue.

Now the problem is that when I open the document what commands do I
issue since the documents I am opening are already linked to the data
source. If I immediately print, I get the field names and not a merge
w/ the actual data.

The following does NOT work:

Documents.Open FileName:=sFilePath & sNextFile,
ConfirmConversions:=False, AddToRecentFiles:=False, Visible:=True

'ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.Destination = wdSendToNewDocument
ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False
' this line even creates a run-time error because the object
can not be found!
'ActiveDocument.MailMerge.Execute

Thank you in advance!

Andy