mail merge for each individual excel doc in a folder

S

salventuro

Hi everyone,

Hope everyone is having a good day.

This is my first post here, I'm a noob, so be gentle. LOL

I am running Office 2003 Pro on XP Pro SP2.

I have been searching the web for a solution to a project I'm working
on, to no avail. I don't know if it's even possible.

I have inserted the image of a form in a Word doc, I have mapped the
fields to be merged from the data in excel spreadsheets

I can perform the mail merge manually. The issue is, I have over one
thousand excel doc's to perform the merge on. Can a macro be used to
loop through a folder, merge and propogate to a new Wrd doc for each
excel doc?


This will create over one thousand word doc's, which will then be
emailed to the corresponding employees.

Also, can the name of the new Word doc created, be saved as the
corresponding name as the Excel doc?
Example, if the Excel doc is named 123abc.xls. can the new propogated
Word doc be saved as 123ab.doc?

Any assistance or links anyone knows of, would be greatly appreciated.

Thanks and have a great day!
 
D

Doug Robbins - Word MVP

It sounds like you are actually creating only one document from each Excel
spreadsheet, which is not really the purpose of mailmerge, though it can be
used for that purpose.

Regardless, to create each of the documents that you want to create from
each of the Excel spreadsheets, you are going to need to use a macro (VBA)
for the purpose.

You will find some information on batch processing all of the files in a
folder in the article "Find & ReplaceAll on a batch of documents in the same
folder" at:
http://www.word.mvps.org/FAQs/MacrosVBA/BatchFR.htm which while it deals
with processing Word documents, the principle is the same (use of the Dir
function)

Of course, each of the spreadsheets are going to need to be identical in
layout to be able to successfully process them and more information would be
needed on the way in which the data that you want to use is contained the
spreadsheets to give you any more specific assistance.

To answer your question about the naming of the resulting Word files, yes
that is certainly possible.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
M

macropod

Hi salventuro,

If the Excel cells you want to read from are always in the same location in each of the workbooks, a better approach might be to use
a template that has a LINK field pointing to any file in the source folder, then simply use the macro to change the linked file
names to correspond with each of the Excel files and save the file as you've proposed with the same name as the Excel workbook
(different extension, of course).

One potential advantage of this over a mailmerge is that the Excel cells don't all ahve to be on the one worksheet. Another is that,
once the files are created and provided you leave the links intact, later changes in the Excel workbooks will be reflected in the
corresponding documents.
 
S

salventuro

The message you are about to post is viewed in a number of different
ways, not just through WordBanter.
 
D

Doug Robbins - Word MVP

So is your problem sorted or not.

As the other forum to which you posted the question requires one to register
to view the content, I will not visit it.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
S

salventuro

Hi Doug,

Thanks for the reply.
I have not resolved the issue as of yet, I am having one heck of a time
with this one.

Any light you can shine on this for me, I would be grateful.

Have a great day!

Sal.
 
S

salventuro

Hi Doug,

Thanks for the reply.
I have not resolved the issue as of yet, I am having one heck of a
time with this one.

Any light you can shine on this for me, I would be grateful.

Have a great day! Below is my post at the other Forum, after someone
mentioned I should have mentioned this post. .

Sal.
- Show quoted text -
Hi macropod,

Yes, I have posted the same question on wordbanter, Great site by the
way. Point taken, I should have mentioned that.

I had difficulties posting a follow up there, as you saw I posted once
in error and then provided more info, when Doug mentioned I should
have provided more details. (Thanks again Doug).

I tried to post to the newsgroup directly, but, got an error, "posting
not allowed or permited". I have been subscribing to newsgroups for
over five years and never got that error message.

I have been searching many sites, trying to get a solution to this. In
my searches I came accross this site, it looked very good, so I
decided to sign up and post here also.

I also noticed you are every where on the web, providing a huge amout
of assistance to others. When I read your response here, I realised I
looked like a bit of jerk for not mentioning it. When I posted here I
didn't think anyone would be interested in my other post. But now I
can see how that can be viewed as a no-no, to all the experts who
provide information and assistance, for no fee and on their time.

I have a website cbtlessons (I can't post links yet) just add www and
dot com), where I provide video instructions for newer PC users (and
math for my kids and their friends). I pay for it out of my pocket and
it's free to anyone.

Unlike these boards, where there are much more knowledge people than
me, I don't have interaction with anyone who visits my web page.

So I dropped the ball here, I should have had more netiquette, and
taken into account the community. My apology for this.

Thanks for the info on the the other fourm by the way. I am studying
up on it, but am no closer to a solution.

Anyway, I hope everyone has a great day.
Gotta go now, my kids are fighting again, where's my ref whistle!

Sal.
 
M

macropod

Hi salventuro,

OK, so what have you tried and what part(s) are you having difficulty with? Doug and I have suggested different approaches you might
take.
 
D

Doug Robbins - Word MVP

Development of an application to perform this task is well within the
capabilities of the Office System, though it is not an "out-of-the-box"
feature.

In addition to the links to which I previously directed you, you would also
need to make use of the information in the article "Control Excel from Word"
at:

http://www.word.mvps.org/FAQs/InterDev/ControlXLFromWord.htm

If I were developing this application, I would be making use of some of the
features in the article "Combining FormFields and Mail Merge" on the
following page
of fellow MVP Graham Mayor's website:

http://www.gmayor.com/Form_Fields_and_Mail_Merge.htm

None of those are of course exactly what you will need, but if you have any
ability with the development of VBA applications, that should be enough to
get you started.

On the other hand, if you want someone to develop something like this for
you, you would have to expect to pay for that work.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Hi Doug,

Thanks for the reply.
I have not resolved the issue as of yet, I am having one heck of a
time with this one.

Any light you can shine on this for me, I would be grateful.

Have a great day! Below is my post at the other Forum, after someone
mentioned I should have mentioned this post. .

Sal.
- Show quoted text -
Hi macropod,

Yes, I have posted the same question on wordbanter, Great site by the
way. Point taken, I should have mentioned that.

I had difficulties posting a follow up there, as you saw I posted once
in error and then provided more info, when Doug mentioned I should
have provided more details. (Thanks again Doug).

I tried to post to the newsgroup directly, but, got an error, "posting
not allowed or permited". I have been subscribing to newsgroups for
over five years and never got that error message.

I have been searching many sites, trying to get a solution to this. In
my searches I came accross this site, it looked very good, so I
decided to sign up and post here also.

I also noticed you are every where on the web, providing a huge amout
of assistance to others. When I read your response here, I realised I
looked like a bit of jerk for not mentioning it. When I posted here I
didn't think anyone would be interested in my other post. But now I
can see how that can be viewed as a no-no, to all the experts who
provide information and assistance, for no fee and on their time.

I have a website cbtlessons (I can't post links yet) just add www and
dot com), where I provide video instructions for newer PC users (and
math for my kids and their friends). I pay for it out of my pocket and
it's free to anyone.

Unlike these boards, where there are much more knowledge people than
me, I don't have interaction with anyone who visits my web page.

So I dropped the ball here, I should have had more netiquette, and
taken into account the community. My apology for this.

Thanks for the info on the the other fourm by the way. I am studying
up on it, but am no closer to a solution.

Anyway, I hope everyone has a great day.
Gotta go now, my kids are fighting again, where's my ref whistle!

Sal.
 
S

salventuro

Doug, macropod.

Thanks for your willingness to assist. Unfortunately I ran out of time
on this project.
I have decided to email the Excel workbook and the Word doc to the
reps, they will merge the two, for the final list of forms to be
completed by their clients.

I created the mail merge Word doc and added this code,

Sub AutoOpen()
With ActiveDocument
MailMerge.Destination = wdSendtoNewDocument
MailMerge.Execute
End With
End Sub

This was probably written by one of you two. LOL (Doug, you are quite
the Word celebrity, authority, guru, maestro…). I feel privileged that
you responded to my question.

I created an instructional video that I will embed in a PDF doc,
showing how to save the attachments, run the mail merge and save the
final Word document.

I will pursue my original question and I will find a solution. When I
do, I will post it back in this thread.

My thanks once more.

Sal.
 
M

MonMonRie

How do I modify my mail merge file? I would like to add another field to the
mail merge file. Can anyone help me?
 
D

Doug Robbins - Word MVP

What version of Word, what type of Data Source?

However, one certain way of doing it is to use the existing data source with
a Directory type mailmerge main document in which you insert the mergefields
into the cells of a one row table that has one extra column, that is
required, but have nothing else in the document. When you execute that
merge to a new document, that document will contain a table with a row of
data for each record in the data source. Insert a row at the top of that
table and into the cells of that row insert the names of your mergefields
(just the names as in your data source, not the actual mergefields) and then
populate the additional empty column with the data that you require for each
record. You can then save and use that file as a data source.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top