How to call open a Word doc with links from within Access 2003

davsch

New member
Local time
Today, 17:42
Joined
Mar 21, 2010
Messages
5
In 2000 I use the following code to open both an Excel file and Word template.
The Word template contains a link to the Excel file so data can be merged into the template.


DoCmd.OutputTo acQuery, "RMA_print_sub", "MicrosoftExcel(*.xls)", "u:\data\dbfile\RMA\PW\rma_sub_data.xls", False, ""
DoCmd.close acQuery, "RMA_print_sub"

Set wordApp = CreateObject("Word.Application")
wordApp.Visible = True

With wordApp
.Documents.open Filename:="u:\data\dbfile\RMA\PW\rma_data_acc.doc"


This does not work in Access 2003. It will pull up the Word template, but the links will not be active and the Merge option is grayed out.

At first I thought this was a Word issue, but if I omit Access from the equation and pull up the Word template after selecting Yes to the following dialogue box:

Opening this document will run the following SQL command:
SELECT * FROM [RMA_out]
Data from your database will be placed in the document. Do you want to continue?

The Word template links will be active and I can run Merge.

So it think the question is: What is the proper syntax in Access to open a Word template that has links to an Excel file?

I have tried:
Application.FollowHyperlink "u:\data\dbfile\RMA\PW\rma_data_acc.doc
and
Application.FollowHyperlink "u:\data\dbfile\RMA\PW\rma_data_acc.doc, , True

But nothing executes at all.

Thanks,

Dave
 
Last edited:
Are you trting to automate a Word mail merge from Access?

I find exporting to a word merge soure works bettter than Excel format.

Note: A word template has a .dot extension. Your code is not really designed to use a Word template.

Are you really using a Word Template (.dot)?
 
Coach,

No, not trying to automate the Merge. (The users have been selecting Merge for many years.)

When the user wants to print a report from Access.
1: Access exports to Excel.
2: Access opens a Word doc. This doc contains links to the Excel file and the user just needs to hit Merge.

But for some reason in 2003, when it calls for the Word doc to open, it does not see the link. (But if I open the doc all by itself, it finds the link)

Sorry, they are .doc's , not .dot's
 
I think I got it!!!!

It is a Registery hack.
MS KB: 825765

Thanks!

Love this forum. :)
 

Users who are viewing this thread

Back
Top Bottom