Compiling body text for an email

D

Dennis Snelgrove

I'm writing a VBA routine in Access to compile an email message
regarding entries in a database. "What's that got to do with Word?"
you say? Well, I want to put formatting into the mail so as to make it
look more readable. The thing is, I've never programmed anything for
Word in VBA. So, I'm starting at the beginning; I defined a variable
as a Word.Paragraph. Can I treat this like a string variable that has
formatting capabilities, or do I have to actually open Word, create a
new document and then compile it in there? if so, then I would the
following be more or less ther right way to do it in an Access module?

1) Set object variables to the Word application, Word document, and
Word paragraph
2) Create a new Word document
3) Run the routine in Access that does the analysis which puts out
paragraphs at a time. Append them to document, and set the formatting
as I'm going
4) After the content is completed and the Access routine has run its
course, create an email in the Access routine, then set the body equal
to the ActiveDocument where the Range will encompass the entire
document
5) Send the mail
6) Close the Document object while not saving
7) Quit the Word Application

I'm sorry for the absolute stupidness of this question, but I do 99%
of my work in Access, so I'm very familiar with the database model.
I've just used Word for some basic typing and not much else.

Thanks for any help or insights...
 
D

Doug Robbins - Word MVP

See the single document mailmerge solution that was created by fellow MVP,
Albert Kallal at

http://www.members.shaw.ca/AlbertKallal/wordmerge/index.html



See the article "How to send an email from Word using VBA" at:

http://www.word.mvps.org/FAQs/InterDev/SendMail.htm

See the article "Early vs. Late Binding" at:

http://www.word.mvps.org/FAQs/InterDev/EarlyvsLateBinding.htm

While I am a Word MVP, I spend most of my time working with Access and if I
were you, I would probably be using a report in Access rather than
interfacing with Word.

Another thing to consider is that as you really have no control over how the
recipient views their email, spending any time on formatting can be futile
if the formatted text is to be sent as the body of an email. If formatting
is important, the document should be converted to .pdf format and be sent as
an attachment to an email message.


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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