Please help, I have created a working Access VBA routine that searches through a query for customer Email Name and Product Type in that order and sends an email to each customer with a data sheet for each product attached.
There are 9 different data sheets held as Word templates
and each attachment needs to be edited with some unique
data for that customer.
My routine creates a temp folder and then, for each customer, depending on the product type opens the correct .DOT file, edits it, saves it with a new name, and then closes it, this loops until the next customer is found, at that stage all the files in the folder are attached to the email and sent, then the folder is cleared ready for the next customer.
The problem is that the files can't be attached to an
email if they are still open so I have to keep opening and
closing the templates, is there a better, more efficient
way to do this?
There are 9 different data sheets held as Word templates
and each attachment needs to be edited with some unique
data for that customer.
My routine creates a temp folder and then, for each customer, depending on the product type opens the correct .DOT file, edits it, saves it with a new name, and then closes it, this loops until the next customer is found, at that stage all the files in the folder are attached to the email and sent, then the folder is cleared ready for the next customer.
The problem is that the files can't be attached to an
email if they are still open so I have to keep opening and
closing the templates, is there a better, more efficient
way to do this?