using Word 2000 for mailmerge in VB

A

Adias

Hi,
I am running into a problem trying to do a mailmerge after I upgraded from
Office 97 to Office 2000. The application is attempting to do a mailmerge
using a Word document as a template with the merge fields, and this document
is located in a network folder. I get an error: "Bad file name. Error:
4160." When I move the template to the local drive, it works fine. I tried
giving Full rights to the network folder, and it still didn't help. I also
tried giving the user local admin permissions to the PC, and I still get that
error. I haven't changed the mailmerge code. The error occurs on the
following line of code:

m_WordApp.Documents.Item(sTempStr).MailMerge.OpenDataSource sDataSource
m_WordApp is defined as Word.Application
sTempStr is a string with the UNC network path and template file name
(\\network\Letters\Template.Doc)
sDataSource is a string with the path and data file
name(C:\projects\Lic60\DATA.Doc)

Here is all the code:

Set m_WordApp = New Word.Application
m_WordApp.Documents.Open "\\network\Letters\Template.Doc"
m_WordApp.Documents.Item(sTempStr).MailMerge.OpenDataSource sDataSource

If you notice the code above, the Open method did run successfully, which
opens the template from the network folder. Why is it having trouble with
the mailmerge.opendatasource method when the template is located on the
network?
 

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