Word images - mail merage


I have a word document that mail merges various charts onto two pages.  Each of the pages has a pupil name.  I what to create seperate documents for each pupil.  So I want to be able to split merge document into seperate files each containing two pages with the title being the pupil name or set up some sort of macro that will insert the images and then save the document.

I have attached the merge file to show what the layout is.  The merge code I am using is similar to
{INCLUDEPICTURE "c:\\TargetCharts\\{MERGE FIELD PupilID}TC.gif"}

I hope this makes sense.  Thanks,

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I am unclear about the nub of the problem. Is it about images as the title suggests? You seem to have that covered.

You can produce separate documents in a couple of ways. You can either run a single-record merge or you can split the document afterwards. Provided that you don't have any section breaks in the main document, the latter is fairly simple.

This macro splits the result document at the section breaks and saves each part as a document named from the text at the beginning of the section (up to the first tab).

Sub SplitMergeResult()
    Dim sec As Section
    Dim rng As Range
    Dim strName As String
    Dim DocA As Document
    Dim DocB As Document
    Set DocA = ActiveDocument
    For Each sec In DocA.Sections
        Set rng = sec.Range
        rng.MoveEnd wdCharacter, -1 'omit section break
        strName = Split(sec.Range.Paragraphs(1).Range.Text, vbTab)(0)
        Set DocB = Documents.Add
        DocB.SaveAs strName & ".doc"
    Next sec
End Sub

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DesiMckAuthor Commented:
Thank you for your excellent and speedy reply.  This solution worked.  Sorry for the over complication in my question and the rather misleading title.
Jamie GashCommented:
I need to control the filename of the newly created sperate document. Ideally I'd like to use a mail merge field from within the document (Clients Account Number). Can you explain how I edit line 13 (I assume) to make this work.
You would need to locate the text somehow on the document. How you do that depends on the document and your skills,

If any further advice is needed, please raise your own question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.