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