Bobby Heid
bheid at appdevgrp.com
Fri May 7 08:41:15 CDT 2004
I'm not sure why, but I was able to get it to work properly by setting up the MM document so that it was not a true MM document. That is, it had the desired merge fields, but there was no source set up in the Word document. Then I used the OpenDataSource function to set the data source. Note that the data source has a single header line in it. Bobby -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bobby Heid Sent: Friday, May 07, 2004 8:38 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Mail merge from Access questions 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 -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com