Hi Lana,
If think this will show you how to split the document created by the merge
into individual files, saving each with a filename that you have in the
datasource in the first instance (e.g. the persons name or something esle
that is unique e.g the number in an autonumber field in the table) Then you
would use that same data in the catalog document in the mailmerge to email
with attachments macro, or you could set up a catalog mailmerge that could
be used for both purposes - starting to get the idea that I like catalog
mailmerges <g>:
Here's a method that I have used that involves creating a separate
catalog type mailmerge maindocument which creates a word document containing
a table in each row of which would be your data from the database that you
want to use as the filename.
You first execute that mailmerge, then save that file and close it. Then
execute the mailmerge that you want to create the separate files from and
with the
result of that on the screen, run a macro containing the following code
and when the File open dialog appears, select the file containing the table
created by the first mailmerge
Dim Source As Document, oblist As Document, DocName As Range, DocumentName
As String
Set Source = ActiveDocument
With Dialogs(wdDialogFileOpen)
.Show
End With
Set oblist = ActiveDocument
Counter = 1
While Counter <= oblist.Tables(1).Rows.Count
Set DocName = oblist.Tables(1).Cell(Counter, 1).Range
DocName.End = DocName.End - 1
'Change the path in the following command to suit where you want to save
the documents.
DocumentName = "I:\WorkArea\Documentum\" & DocName.Text
Source.Sections.First.Range.Cut
Documents.Add
Selection.Paste
ActiveDocument.SaveAs filename:=DocumentName, FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
ActiveWindow.Close
Counter = Counter + 1
Wend
--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
Lana said:
Hi Doug,
I appreciate your macros very much indeed. However, my problem is prior
to that I think. I create a memo in Word and mail merge it with a name and
a code from fields in an Access table. Now I have one Word document with
300+ unique memos in it. I assume that I must now split those memos into
individual files ( I can again use someone's great macro to accomplish this
step). My problem is - how do I now get the path names for these memos back
into my source file (the Access table) as a new field with each unique memo
path in the row for the correct person? Again, I'm assuming, that I must do
this in order to then create the 'catalogue' mail merge that would include
in the first cell of each table row the individual's e-mail address and
include in the second cell of each row the path to the memo file for that
person (<<Attachment1>>)? If I am interpreting it correctly, this is the
point at which I could then use your emailmergewithattachments() macro. It
would pick up the e-mail address from cell 1 and the attachment from the
document path in cell 2 of every row, thereby creating an e-mail message (my
active document) with a unique attachment (as indicated by the document
path) for each person. My problem is creating and pointing to the document
path. If you see something simple that I am overlooking in this process,
please let me know. I have already done the project, albeit less than
ideally as I explained earlier, but I would like to know how to solve this
problem for future projects. It is even more complicated because I have two
different memos, some of which go to some people and some of which go to
others, but I would be willing to create two tables and work on them
individually if I must.