I have created the following macro to use within a letter, trying to make it as effortless for our users as possible. The problem is when you go to run the macro you are prompted by the Confirm Data Source box everytime. Is there a way to add code into the OpenDataSource part of the macro that recognizes the following steps, so the user doesn't have to do this everytime?:
1. Confirm Data Source box - check the show all box and click ok button
2. Pick text files from list and click ok button
3. Header Record Delimiters box - choose , for field delimiter and (enter) for record delimiter
************************************************************************************************
Sub ADINC()
'
' ADINC Macro
' Macro recorded 5/18/2004 by jwheeler
'
ActiveDocument.MailMerge.OpenDataSource Name:= _
"C:\Documents and Settings\jwheeler\Desktop\ADINC_JWHEELER_CQO", _
ConfirmConversions:zlse, ReadOnly:zlse, LinkToSource:=True, _
AddToRecentFiles:zlse, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:zlse, _
Format:=wdOpenFormatAuto, Connection:="", SQLStatement:="", SQLStatement1 _
:="", SubType:=wdMergeSubTypeOther
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
End Sub
************************************************************************************************
Any help would be greatly appreciated.
TIA
--------------------------------
From: Jadie Wheeler
-----------------------
Posted by a user from AdminLife (http://www.adminlife.com/)
<Id>jDV+gn5O70SmWyOSk0z60A==</Id
Cindy M -WordMVP- - 24 May 2004 15:38 GMT
Hi Jadie,
Which version of Word? What is the data source type? You mention something about text
files, but I don't see any file extension for the file name in your code sample.
If this is a text file, what field and record delimiters does it use?
It looks to me like Word isn't recognizing the file type properly. If you turn on the
display of file extensions, then record the OpenDataSource in a macro, does this work
any better?
> I have created the following macro to use within a letter, trying to make it as effortless for our users as possible. The problem is when you go to run the macro
you are prompted by the Confirm Data Source box everytime. Is there a way to add
code into the OpenDataSource part of the macro that recognizes the following steps,
so the user doesn't have to do this everytime?:
>
> 1. Confirm Data Source box - check the show all box and click ok button
> 2. Pick text files from list and click ok button
> 3. Header Record Delimiters box - choose , for field delimiter and (enter) for record delimiter
>
*************************************************************************************
***********
> Sub ADINC()
> '
[quoted text clipped - 8 lines]
> Format:=wdOpenFormatAuto, Connection:="", SQLStatement:="", SQLStatement1
> :="", SubType:=wdMergeSubTypeOther
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply in
the newsgroup and not by e-mail :-)