I'm trying to change the name of the MailMerge datasource file inside
a Word 97 document by calling
"ActiveDocument.MailMerge.OpenDataSource" during "AutoOpen". But the
Word document is still remembering the name of the datasource file
from last user who amended the document.
This code is exected in AutoOpen. FileName is set to the name of the
Datasource file for this user.....
Sub AutoOpen()
CurrentUser = Environ("Username")
FileName = ".....................\" & CurrentUser & "_word.txt"
ActiveDocument.MailMerge.OpenDataSource _
Name:=FileName, _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:=", PasswordTemplate:=", _
WritePasswordDocument:=", WritePasswordTemplate:=", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:=", SQLStatement:=",
SQLStatement1 _
:="
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = "
.MailSubject = "
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
ActiveWindow.ActivePane.LargeScroll Down:=1
ActiveWindow.ActivePane.LargeScroll Down:=-1
End Sub
Thanks,
Mike Collins,
Weymouth, England.
ActiveDocument.MailMerge.MainDocumentType = wdNotAMergeDocument
ActiveDocument.MailMerge.MainDocumentType = wd<whatevertypeyouwant>
first?
Peter Jamieson
MS Word MVP
"Mike Collins" <mikec...@talk21.com> wrote in message
news:3b9fb9d1...@news.freeuk.net...
Peter Jamieson
MS Word MVP
"Alan Schmidt" <al...@goconnected.com> wrote in message
news:B7C66FD6.79B1%al...@goconnected.com...