S
Shane Buchholz
I have created a Word document that pulls data from a database, writes
that data to a text file and then uses that file as the datasource for
a mail merge. I have set the code up to delete and recreate the source
file whenever the form is run so that I only get current data. The
form is doing what I want it to, save one thing: the source file
becomes associated with the main document during the merge process. If
I try to run the form again to get new data, I get a "permission
denied" error when the code tries to delete the old source file.
Does anyone know how to disassociate the source file from the main
document in VBA. I can do it manually, but I am going to release this
to a non-technical user and I would like the process to be seamless.
The "manual way" is to close the document, delete the source file and
then re-open the document. At this point Word tells you the source
file no longer exists and gives you the option of removing the
data/header source. I created a macro to record the steps when I
re-open the file, and remove the data/header information but that was
not helpful. Thanks in advance.
Richard O'Neil
that data to a text file and then uses that file as the datasource for
a mail merge. I have set the code up to delete and recreate the source
file whenever the form is run so that I only get current data. The
form is doing what I want it to, save one thing: the source file
becomes associated with the main document during the merge process. If
I try to run the form again to get new data, I get a "permission
denied" error when the code tries to delete the old source file.
Does anyone know how to disassociate the source file from the main
document in VBA. I can do it manually, but I am going to release this
to a non-technical user and I would like the process to be seamless.
The "manual way" is to close the document, delete the source file and
then re-open the document. At this point Word tells you the source
file no longer exists and gives you the option of removing the
data/header source. I created a macro to record the steps when I
re-open the file, and remove the data/header information but that was
not helpful. Thanks in advance.
Richard O'Neil