mailmerge macro

Ric_UK

New member
Local time
Today, 20:35
Joined
May 3, 2010
Messages
4
Hi all,

I'm trying to build a macro to perform a mail merge. I'm using the macro function and so far can get the macro to begin the mail merge. Access presents me with a pop up box called 'microsoft word mail merge wizard' which then presents you with the window for mail merges.

Is there an action in macro's to click the ok so it brings me to the point where to select the file from.

If this is possible, on the next step can a macro action be created to insert the place to get word document from?

Many thanks.
 
Hi Ric, and welcome to the forum,

To get your mail merge working you might need to add some vba code to open word and then the document and possibly add bookmarks so the code would then place in the field detail for you ! How are you with VBA?

In your database use Alt + F11 on the keyboard (this takes you to VBA), then select the Tools menu and then look down the list to find Microsoft Word Object Library with a number (this will be your version of microsoft), place a tick in the box and and the click close.

You would then need to insert a module from the insert menu.

Then add code like this:

Function OpenWord1()
Dim wrdApp as word.application
set wrdApp = CreateObject("Word.Application")
with wrdApp
.visible=true
.documents.open "Enter the path and complete file name including .doc"
.Selection.GoTo What:=wdGoToBookmark, Name:="Bookmark name"


end with

See how you get on here?

Did you know you can record marcos in word to give you the code to goto bookmarks etc?
 
Thanks Trevor,

I'm a total newby at access and VB. I'm wondering if there is anywhere that I can get some basic information on how it works. So being able to find some basic info on how VB works will be brilliant. I did try to use the bit of code you put in but it still didn't open a word document. It helped that I needed to tick the word object box in references, but it still isn't working.

Thanks,

Richard.
 
Thanks Trevor,

I'm a total newby at access and VB. I'm wondering if there is anywhere that I can get some basic information on how it works. So being able to find some basic info on how VB works will be brilliant. I did try to use the bit of code you put in but it still didn't open a word document. It helped that I needed to tick the word object box in references, but it still isn't working.

Thanks,

Richard.

See:

Super easy Merge
 
I've looked at this example, and understand the code a little. I've followed the instructions and imported the 2 modules and created the button with the following;

Private Sub cmdWord_Click()

MergeSingleWord

End Sub

but nothing is happening. What I did notice is that in the example database, if I press alt+F11 it takes me to VB, however in my DB that i've created, this function doesn't work.

Do I need to active anything within VB. I followed trevors advise and in tools, references, I clicked microsoft word object libery 12.0.

Is it me or am I missing something, this is really frustrating. I can't understand why it will work in sample DB but not my own?

Thanks,

Richard.
 
Rich,

What happens if you copy over the forms and modules, will that work for you?

On your command button in design view does it show you the on click event being selected and then shows the procedure?

If all these are correct and done, would you be able to upload a smaple database with your stuff in it, Include a word document as well.
 

Users who are viewing this thread

Back
Top Bottom