Tools > Office Links > Merge It with MS Word

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Windows XP and Office 2000

I have MS Word documents that I use for mail merges, and I am trying to
automate them. In Access 2000, I can click on a query and click Tools >
Office Links > Merge It with MS Word. I would like to be able to type this
in VBA code.

For example, I would like to open the document "c:\letter1.doc" using the
query "letter1" with microsoft word. Pseudocode would be something like...

docmd.wordmerge(path to document as string, query name as string)

Any suggestions?

Thanks!

Nick
 
The Office Products have a means for you to view the VBA code that is
generated when you run the options.
On the menu Tools -> Macros, you will see the ability to record a macro,
playback a macro, and open the Visual Basic editor.

I would explore the help file a bit more on the use of Macros.

HTH

Rob

--
FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

FMS Advanced Systems Group
http://www.fmsasg.com/
 
Hi, Nick.

If you want to call the MailMerge Wizard from VBA, then you may do so with
the following code:

DoCmd.OpenQuery "letter1"
RunCommand acCmdWordMailMerge

If you want to pass a path and file name to the Wizard there's no parameter
for this. What you'd need to do is duplicate this Wizard's code and modify
it to accept the path and file name for the saved document. This exercise is
probably not an effective use of your time. Just automating Word and
duplicating the merge functionality would likely be more productive.

However, if you'd like to see what's involved with the Wizard approach, then
you may take a look at much of the code within this Wizard, which you may
download from the following Web page:

http://support.microsoft.com/default.aspx?id=151196

Take a look at the code module for the pm_frmMain form and the pm_Entry( )
function. Unfortunately, the code was written in VBA 4.0, but you should be
able to translate it to VBA 6.0.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 
Hi, Rob.
The Office Products have a means for you to view the VBA code that is
generated when you run the options.
On the menu Tools -> Macros, you will see the ability to record a macro,
playback a macro, and open the Visual Basic editor.

With the exception of the ability to open the VB Editor from the menu, none
of the other features you mention exist in the current or previous versions
of Access.

You work for FMS? Is that why FMS is looking for new application
developers? Because the current employees work with SQL Server and .Net
technologies, but not with Access any more? ;-)

http://www.fmsinc.com/toplevel/helpwant.htm

FMS could choose from the pool of the plenty of Access experts who post
answers in these newsgroups. They're all very familiar with Access. Or
does the "junior and mid-level developers" preclude Access experts?

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.
 

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

Back
Top