How to programmatically reattach mergedata in MSWord mailmerge doc?

  • Thread starter Thread starter Sidney Linkers
  • Start date Start date
S

Sidney Linkers

Hi All,

I use MSWord mailmerge from an MSAccess database (A97) through OLE.
Everything works fine, except that i want to be able to tell the MSWord
mailmerge (.doc) to reconnect to another maildata file (.txt).
The problem i encountered is that you first have to open the MSWord
mailmerge doc before you can do anything. By that time MSWord already tried
to connect to the maildata and if it's not there MSWord stays in a loop till
you manually assign the location of the maildata file or reset the MSWord
mailmerge to a normal document.
If i just could reset the MSWord mailmerge doc to a normal doc before
opening it than the problem is solved. I know how to change a normal doc to
a mailmerge doc.

Any help would be great!

Sid
 
I know it's a kludgy work-around, but in such cases I have used a dummy file
which I always leave in the same position. That way I can programmatically
open the mailmerge document (linked to the dummy file), then change the
link.
Another workaround is to programmatically copy the desired file to the
dummy location before opening the document...

HTH
- Turtle
 
Hi Turtle,

Not a bad idea, but i have a situation where different clients have an
implementation of the same application. The location where the files are
being installed are different. It would be nice if the application could
reattach the MSWord docs to the right mergedata files. The problem is that
the path to the mergedata files is hardcoded in de MSWord docs and when i
open the MSWord docs, it directly starts to connect to the mergedata file
and it's not at the expected location (and we dont to user to "swim" in this
manual attachment procedure).

Thanks anyway for your suggestion.

Sid
 
I'm still not saying that my solution is any great shakes, but you could
have your application create a dummy file at the default location just
before it opens the MailMerge document. If you're worried that your users
might find it afterwards, you can always delete it once you have the
MailMerge document open and correctly linked...

HTH
- Turtle
 
Hi Turtle,

The problem stays the same. I have no garantee that the default location
exist on the clientside or that i will have rights to create a file at the
default location. The only garantee i have is that i will have rights in the
folder and subfolders where the application is installed (this could be
anywhere). Because the application has 30 MSWord merge docs to begin with
and could have more in the future, it takes a lot of time to manually attach
the MSWord documents to theire respective mergedata files. The problem
really lies in the MSWord doc where the location to the mergedata file is
stored. If i could find a way to reattach via OLE calls to the Word object
before it tries to connect to the mergedata file than i'm happy as a puppy.
The average user will trip if he has to manually attach to a mergedata file,
they even don't know what it is! And why should they?

Thanks for your suggestion.

Sid.
 
Back
Top