Access/Word Merge 2003

C

Connie

Hi All:
I have a database that is sending data to Word for a mailmerge. It is a
dynaset and opens the correct letter (case statement) then merges data into a
new document. It works great in Access Word 97 and Access Word 2000, but
2002, No, and 2003 NO!
Here is my code and if someone could just help me with this, or show me the
error of my ways, I would so very, very thankful! I have been working on this
for three years, off and on to try to make this work, please help, I have no
more ideas.....Regards, Connie

Dim objwordapp As Word.Document
Dim objWord As String
Dim tblName As String

'Set objwordapp = CreateObject("word.application")

'Set objword = objwordapp.Documents.Open(fname)
objWord = fName
Set objwordapp = GetObject(objWord, "Word.Document")
tblName = "tblqry" & Left(savedName, 8)
objwordapp.Application.Visible = True

'Execute the mail merge.
objwordapp.MailMerge.OpenDataSource _
Name:=CurrentDb.Name, _
LinkToSource:=True, _
Connection:="TABLE " & tblName, _
SQLStatement:="Select " & tblName & ".* from " & tblName
objwordapp.MailMerge.Execute
objwordapp.Close
objwordapp.ActiveDocument.SaveAs (mypath & "\" & savedName)
objwordapp.Quit

'Dim objWord As Word.Document
'Dim stMergeDoc As String

'If fSetAccessCaption Then
'On Error Resume Next
'stMergeDoc = "J:\install\Access mdbs\mailmerge.doc"

'Set objWord = GetObject(stMergeDoc, "Word.Document")

'objWord.Application.Visible = True

'objWord.MailMerge.OpenDataSource _
Name:=CurrentDb.Name, _
LinkToSource:=True, _
Connection:="TABLE Customers", _
SQLStatement:="Select * from [Customers]"
'objWord.MailMerge.Execute



rs.AddNew
rs!GameNames = GameName
rs!Merged = True
rs.Update
 
C

Cindy M -WordMVP-

Hi Connie,
I have a database that is sending data to Word for a mailmerge. It is a
dynaset and opens the correct letter (case statement) then merges data into a
new document. It works great in Access Word 97 and Access Word 2000, but
2002, No, and 2003 NO!
It always helps to describe HOW something doesn't work. That there's a problem
moving to Word 2002/2003 doesn't surprise me. But there could be a couple of
reasons, and a description of how it fails, with what messages, and (if there's
an error) on what code-line is important.

Please give us that information, and also explain why the code you've posted
contains so many lines that are commented out.

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

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