Access 2002 Merge with Word 2002 with Intranet use

L

Larry Jones

I am trying to work on a database, that was created by someone who has left
the company (so much fun).

This particular part of the code, that is causing some trouble, is taking a
Word document from a local location on the persons computer, running the
mail merge, then saving the new document on our intranet.

There are several problems in this area, but one of the things I would like
to do is to remove the document from each persons computer and put the base
document on our intranet, so Access can grab it from there. But I can't
figure out how!

The code (below) is what currently is being executed in the program.

Path2 = the C:\ location of the base document
Path1 = the C:\ location of the database (which I am changing to
Currentdb.Name to remove the hard coding)
Path3 = the intranet address (https://xxx/yyy/zzz) where the merged document
is stored

I have put the base document on the intranet and tried changing the Path2
variable to point to that (https://xxx/yyy/zzz/qqq.doc) , but it didn't
work. I get an "Automation error Invalid Syntax" error when I execute the
Set objWord line with the intranet location. I was hoping it would be that
simple, since saving it to the intranet seems simple. Is this possible
(surely it is) and if so, what am I doing wrong?

Set objWord = GetObject(Path2)
' Make Word visible.
objWord.Application.Visible = True
'Store name of document for later use
objWord.mailmerge.OpenDataSource _
Name:=Path1, _
LinkToSource:=True, _
Connection:="QUERY qryForInterfaceWordDocument", _
SQLStatement:="Select * from [qryForInterfaceWordDocument] Where
select = -1"
' Execute the mail merge.
objWord.mailmerge.Execute
'Save the New Word Document to specified path.
objWord.Application.ActiveDocument.SaveAs (Path3 & myDocName &
".Doc")
'Quit Word.
objWord.Application.Quit
'Release Variable
Set objWord = Nothing

Thanks,
Larry
 

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