![]() |
#1
|
|||
|
|||
![]()
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 |
![]() |
Tags |
changefileopendirectory, mailmerge field |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Invain | Word | 1 | 02-14-2010 07:08 AM |
Force to select a group of word? | jakekei | Word | 0 | 01-21-2010 04:20 PM |
Select text between characters | davers | Word | 10 | 05-24-2009 05:15 AM |
How to write in Word from Select query | lakhan.p | Word | 0 | 03-27-2009 07:25 AM |
![]() |
JosL | Office | 3 | 03-07-2009 12:40 PM |