Group: microsoft.public.word.vba.general
From: =?Utf-8?B?SmVhbi1HdXkgTWFyY2ls?=
Date: Tuesday, February 19, 2008 9:21 AM
Subject: Re: How to close the template or Document 1

"malycom" wrote:

> Hi Jean-Guy
>
> I have made the changes you suggested but although there is only one
> document open, there are still 2 prompts to save, 1 for the .doc and 1 for
> the .dot.
>
> I am happy with the way the rest xof the script is working and I am not to
> worried about the prompts so thanks you very much for your help.
>

Which ".dot" is being prompted for a Save action? The one that contains the
AutoExec code?

If so, try this version instead:

Sub AutoNew()

Dim doctemp As Document

Set doctemp = ActiveDocument

With doctemp
With .MailMerge
.MainDocumentType = wdFormLetters
.OpenDataSource Name:= _
"C:\ENTMRG.DBF", ConfirmConversions:=False
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute
End With
.AttachedTemplate.Saved = True
.Close wdDoNotSaveChanges
End With

End Sub

If it still does not work, then it means you have some other code in the
.dot that makes changes after the AutoExec code runs.

Safety Articles | Usenet Groups | Usenet News | Bluegrass