I have a unique problem with my Excel VBA based application.
Let me set the stage ...
I have a userform with a series of toggle buttons, each one representing a different report option, in my userform. When the user selects one (or more) reports by pressing that report's associated button that report query is put into a cue for which the code will loop through to process each.
Within the loop, a Word mail merge is executed for that particular report. The mail merge is executed, the document created, and subsequently saved. Those newly created Word documents remain open. The preference is for the user to close those word documents by clicking the previously depressed toggle button corresponding to that particular report in the userform. This appears to be working OK.
Now the user has the ability to access these documents once created (and before being closed) and edit and print them. They print fine, but they are unable to save any changes. The user can click the save icon in the menu of the open word document until their mouse batteries go dead and nothing saves. However, if you go back to Excel, click on the worksheet, and then go back to the Word document, you can save it. (almost like doing so broke a tether between the two docs)
If the user accesses these Word documents from the location they were saved (ie from the directory) from a closed state, they open, and can be edited, but again, cannot be saved. That is as long as Excel is open to the application that created the docs. EDIT: This is not the case. Even with EXCEL closed, these previosuly created mail merged documents, although editable editable. cannot be resaved due to file permission errors.
What I have discovered is, if my Excel application is closed, these files no longer exhibit the difficulties saving due to file permission errors. It would appear that once Excel has initiated and generated these reports, that it has some "lock" on them. These documents, as long as the Excel application used to generate them is open, they appear not to be fully released from the Excel generation code.
Here is the entire macro I use to do all of this. Perhaps someone is able to share with me what the problem might be and hopefully a relatively simple solution for this analysis.
Thank you all in advance.Please Login or Register to view this content.
Bookmarks