View Single Post
  #5   Report Post  
Ed B
 
Posts: n/a
Default

Hi, Cindy

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.

I don't know if this is what you were looking for, but I don't know of
another method to start Word that allows me to run the macro I recorded.


--
Have a nice day, Ed


"Cindy M -WordMVP-" wrote:

Hi ?B?RWQgQg==?=,

OK, the simple part first. The message you're getting is explained in this
article, and it also gives you a work-around (a Registry key):

"Opening This Will Run the Following SQL Command" Message When You Open a Word
Document - 825765
http://support.microsoft.com?kbid=825765

For using the macro in Access, you have to automate the Word application. Could
you show us the code you're currently using to access Word in order to use the
SendKeys, please? We need that to "wrap around" the recorded code.

I recorded the following Macro in Word 2002
Sub MergeStandardLetter2()
'
'
ChangeFileOpenDirectory "G:\Regulatory\Form Letters\"
Documents.Open FileName:="Standard.doc", ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", Format:=wdOpenFormatAuto
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
End Sub

But I have two problems,
a) Every time I run the Macro, I get the following screen box that I have to
respond to, that I would like to eliminate:

Opening this document will run the following SQL Command
SELECT*FROM [Payments & Filing - Current Session] WHERE (([LegalEntity] IS
NOT NULL))
Data from your database will be placed in the document. Do you want to
continue
YES NO
{would not allow me to paste the actual box on this post}

b) I donĂ¢‚¬„¢t know how to call up this Macro in Word from Access 2002.


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 :-)