Prompt user for data source

G

Guest

Hi

I have a word document that I need to be able to merge with fields from an
Excel doc. The problem is that although the fields will be the same, I need
to select a different data source every time.

What I need to know is how to make the Word Merge Doc prompt the user on
opening to select their data source.

The simpler the better... I'm not that advanced.

Thanks :)
 
G

Graham Mayor

Save the merge document as a template and in it save the following macro

Sub Autonew()
Dialogs(wdDialogMailMergeOpenDataSource).Show
End Sub

Then when you create a new merge document from it you will be prompted for
the data file.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Guest

Hi Graham

Thanks for the code... does exactly what I want. I am however, getting
prompted TWICE for a data source... When I open a doc, it prompts me, I
choose the correct source, then it prompts me to again, I choose the correct
source and THEN it opens...

Any ideas on why it's doing this?

Thanks :)
 
G

Graham Mayor

It works OK here with sample templates. Does yours have any other code? Did
you save the macro *in the template*.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.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