Automating a mailmerge from Excel

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

Guest

H

I'm trying to automate a Word Mailmerge from Excel. My data source is within Excel and the letter is in Word. Can anyone help me with the code for this?
 
Hi Jim,
I have a page on using Mail Merge for printing labels, it is much
the same whether you print labels or print a letter, or an envelope.
http://www.mvps.org/dmcritchie/excel/mailmerg.htm
The Excel worksheet you use must be placed so that it is the
leftmost worksheet tab.

Pages by people oriented to Word can be found at.
http://www.mvps.org/dmcritchie/excel/mailmerg.htm#more

How to create a Mail Merge by Beth Melton and Dave Rado.
http://www.mvps.org/word/FAQs/MailMerge/CreateAMailMerge.htm
Take a look at Cindy Meister's web site (.ch is Switzerland)
http://homepage.swissonline.ch/cindymeister



JimPNicholls said:
Hi

I'm trying to automate a Word Mailmerge from Excel. My data source is within Excel and the letter is in Word. Can anyone help me
with the code for this?
 
Davi

I've had a look at your website and found the section detailing how to control Word from Excel. I've used the following example code

Dim wrdApp As Word.Applicatio
Dim wrdDoc As Word.Documen
Dim i As Intege

I'm using Excel 97 and it doesn't give you the "Word.Application" option. When I try to debug it a message appears saying that it's not a defined command. Is this something that I'm doing wrong?
 
Hi Jim, (posted to microsoft.public.excel.misc
You are referring to code on the web pages of Ole P. Erlandsen,
which you found from links on my page.
http://www.mvps.org/dmcritchie/excel/mailmerg.htm

Sorry I just use Mail Merge manually, and by automating you were,
of course, interested in macros for automating use of MS Word and
Excel together. Probably more in the domain of Word
Developers. Did you check the comments within the code
from Ole's pages.
http://www.erlandsendata.no/english/vba/ole/controlword.htm

From the VBE (Visual Basic Editor)
Tools, References,
[x] Microsoft Word 9.0 Object Library -- for my Excel 2000
You would have to change for the comparable earlier library, probably
Microsoft Word 8.0 Object Library -- for your Excel 97, perhaps

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

JimPNicholls said:
David

I've had a look at your website and found the section detailing
how to control Word from Excel. I've used the following example code:

Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim i As Integer

I'm using Excel 97 and it doesn't give you the "Word.Application" option. When I try to debug it a message appears saying that
it's not a defined command. Is this something that I'm doing wrong?
 
I've had a look at the code but it didn't make much sense. Thanks for your time anyway.
 

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