View Single Post
  #6   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?B?RWQgQg==?=,

The SendKeys statement (SendKeys = +%TLM~G:\Regulatory\Form
Letters\Standard.doc~%(trmm) ) shows the strokes to open Word. the Tools,
Links, Merge it with Word command is the one called. This coupled with the
call of the Standard document used to be enough to open Word and Merge the
data from the Access table.

Shift+Alt+T, followed by L and then M opens Word? What menu commands are these
in Access?

Not that it matters, I suppose, because you won't be able to go this route to
do any sensible automation... Automating another application is not a trivial
thing for someone with minimal programming experience, but let's see...

You need to copy this to an ACCESS module and test. I'm not going to guarantee
that I won't make any typing/syntax errors.

Before you try to run it, you need to go to the Tools/References menu in the
VB Editor and activate the checkbox for "Microsoft Word 10" (or similar).

If you get error messages, be sure to quote the full and exact text in your
reply, and indicate on which line it occurs.

Sub MergeStandardLetter2()
Dim wd as Word.Application
Dim doc aS Word.Document

Set wd = new Word.Application
wd.Visible = True
Set doc = wd.Documents.Open( _
FileName:="G:\Regulatory\Form Letters\Standard.doc", _
ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto)
With doc.MailMerge
.Destination = wd.wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wd.wdDefaultFirstRecord
.LastRecord = wd.wdDefaultLastRecord
End With
.Execute Pause:=False
End With
Set doc = Nothing
Set wd = Nothing
End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)