View Single Post
 
Old 06-18-2010, 01:30 AM
andywal6 andywal6 is offline Windows XP Office 2000
Novice
 
Join Date: Jun 2010
Posts: 2
andywal6 is on a distinguished road
Default Select Folder for saving in to

I use this vb below to merge and save my documents with a data source created in MS Access.
The data source contains a field named 'FolderNo'
Is it possible to access this field in the data source and insert it programmatically in to the ChangeFileOpenDirectory statement in place of the 'XXXX' useing:
'MailMerge.Fields' or 'Selection.Range, Name:="FolderNo"'
Many thanks in advance.
Andy......


Private Sub Document_Open()
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
ChangeFileOpenDirectory "C:\My DataBase\WordQuotes\XXXX"
ActiveDocument.SaveAs FileName:="Thank You Letter.doc", FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
End Sub
Reply With Quote