[AccessD] Mail merge from Access questions

Bobby Heid bheid at appdevgrp.com
Fri May 7 07:37:46 CDT 2004


Hi all,

I am creating a flat file from access to be used in mail merge initiated by
access.  I basically create the flat file then load a pre-configured mail
merge document and do the mail merge.

The problem that I cannot figure out is how to have the column names in the
flat file but not have them show up as the first record.  

Here's my relevant code:

   Set objWord = New Word.Application
   Set objDoc = objWord.Documents.Open(strMergeDoc)
   objWord.Application.Visible = True
   
   With objDoc.MailMerge
      .MainDocumentType = wdFormLetters
      '.OpenHeaderSource Name:=strDataFile, Format:=WDOpenFormatText,
ReadOnly:=True
      '.opendatasource Name:=strDataFile, Format:=WDOpenFormatText,
ReadOnly:=True
      .destination = wdSendToNewDocument
      .Execute
      End With

I tried using OpenHeaderSource to add a header file that has the column
names in it, but it seems to ignore it.

I added the following line to try to use the OpenHeaderSource function:

.OpenHeaderSource Name:=strDataFile, Format:=WDOpenFormatText,
ReadOnly:=True

Anyone have any ideas as to what I am doing wrong?  I'm sure it is some
really easy, but U just can't see it.  I did look through the archives, but
did not see what I was doing wrong.

Thanks,
Bobby




More information about the AccessD mailing list