Data Source Declaration

T

That Bloke

Is it possible to identify the path to the datasource in a Word template?
The data is always in the same place, it's just several users put their
templates all over the place on the server and I can't be arsed to edit the
templates on a per user basis.

Thanks,

Pete
 
P

Peter Jamieson

Only after you open them in Word.

You could open them all programmatically one by one, examine
ActiveDocument.MailMerge.DataSource.Name, (and for future reference you
might find it useful to record the following as well)
ActiveDocument.MailMerge.DataSource.ConnectString
ActiveDocument.MailMerge.DataSource.QueryString
ActiveDocument.MailMerge.DataSource.Type (just in case)

Then for each one whose datasource needs to change (I don't know how you
would work that out), issue:

ActiveDocument.Mailmerge.DataSource.Close

then issue the OpenDataSource you really want.

Trouble is that if the datasource is not where the template expects you
probably won't get as far as opening the template.

Peter Jamieson
 
T

That Bloke

Thanks for the info, Peter. The data will always be in the same place and
everyone uses the same source. It's just I have no control where people put
their templates.
 
P

Peter Jamieson

The templates are always pointing to the same data source and the data
source is not being set up by a macro, they should all have the same path
embedded in them, barring anomalies suchas use of mapped network drive
letters, and UNC pathnames. I don't think they will ever have relative path
names but I wouldn't rule it out. Not sure if that helps you but there you
go.

Peter Jamieson
 

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