RichardOneil
MIS
Hi-
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 non-technical user and I would like the process to be seamless.
Thanks in advance and Happy Thanksgiving.
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 non-technical user and I would like the process to be seamless.
Thanks in advance and Happy Thanksgiving.