#  Other Applications & Softwares  > Word Formatting & General >  > [SOLVED] Mail Merge to create separate PDF documents

## Phlegon_of_Tralles

I've been working on a way to use an excel sheet to auto-populate PDF documents. At first I tried to do this through a macro, but I wasn't that successful.

Taking a tip from the person who responded, I've attempted to do a mail merge, however my knowledge of mail merges is *extremely small*. That said, I've managed to create something that just might fit the bill. The trouble is, when I 'Print' and then select the PDF as my printer, it prints all my documents in one package as opposed to individually saving each of them. Also, the 'merge to Adobe PDF' doesn't seem to work. What am I missing?

I've also provided the example PDF.

How do I format the word document (ex. make the salary amounts show as currency)?

----------


## macropod

See _Send Mailmerge Output to Individual Files_ in the *Mailmerge Tips and Tricks* thread at:
http://www.msofficeforums.com/mail-m...ps-tricks.html
or:
http://windowssecrets.com/forums/sho...ips-amp-Tricks

----------


## Phlegon_of_Tralles

Dude this cool! Thanks! 

I've edited the macro and it's almost perfect. I'm getting a run time error see attached. It doesn't seem to prevent the macro from working though...

I've uploaded a pic of the error and a notepad of the macro, here's the macro below:




```
Please Login or Register  to view this content.
```

----------


## macropod

I don't know why you'd be getting a runtime error and you don't indicate what the error message said or what code line was highlighted. You also haven't used the code tags, which makes it much harder than it need be to read the code.

----------


## Phlegon_of_Tralles

My apologies, I thought I attached a screenshot. 

It's Run-Time error '5853':
Invalid Parameter

When I go to debug, the highlighted row is:
.ActiveRecord = i

When I mouse over that row it says:
.ActiveRecord = i = False (I'm not sure if that helps).

----------


## macropod

The code works fine when I test it with your sample document & data source from post #1. Perhaps your Office installation has a fault. Try repairing the Office installation (via Windows Control Panel > Programs > Programs & Features > Microsoft Office (version) > Change > Repair).

----------


## Phlegon_of_Tralles

That seems to have worked, but now I have run into a new error. I saved a copy of the excel, plus the word document, in a folder on a shared drive.

When my coworker goes to access it, she gets the expected 'Opening this document will run the following SQL command:"

Then it requires her to find the linked data sheet. She finds it (it's in the same folder) and she gets this error:

Error has occurred: Could not find installable ISAM


We've searched online and tried some solutions, but they don't seem appropriate; example: One calls to go into the excel document, go to 'connections' and then adjust something there - but when I do, there is *nothing* in the connection screen.

----------


## macropod

Try having your colleague repair her Office installation.

----------


## raxs

Good afternoon, 

Firstly, apologies for posting on a very old thread. I am relatively new to VB and was hopign someone can help me. I am trying to split the document and have successfully managed to run the code linked above. However, I am getting the documents saved as 1,2 .....

In my mail merge (word) file, I have a logo of the company, and the next line is the name of an Employee. Is it possible to tweak the code to use the employee name as file name as oppose to 1,2...?

Thank you in advance.

----------


## AliGW

*Administrative Note:*

We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

Please see Forum Rule #4 about hijacking and start a new thread for your query.

If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

----------

