I'm automating Word 2013 from Excel 2013. Excel directs Word to:
- Create a new document based on a template I had previously set up.
- Update the links in the Excel chart objects embedded in the document.
- Break the links in those Excel chart objects (so that those charts become part of a static report and don't update with someone else's data).
The user can run the project in two modes: running a single report, and running a batch of reports. In batch mode, it saves and closes those files. There are no problems with the Word docs made during batch mode.
The problem is in one-by-one mode, which leaves the report open and unsaved for the user. If the user does nothing but close the document without saving it, they are prompted to save changes in the template. Then, after the document closes, they are prompted AGAIN to save changes in the same template, while Word is showing that it has no documents open.
I've tried setting the template's Saved property to True, but it doesn't help.
(BTW if they save the doc, close it, reopen it, and close it again, it doesn't prompt them to save the template then.)
If I manually double-click on the template file, so that Word opens a new document based on it, and then manually close the new document, Word does NOT prompt to save the template.
I could give the user a browse dialog and prompt them to save the file, but one possible reason for running the one-by-one mode in the first place is if they just want to take a quick look at a report without saving it.
What can I do to make Word stop prompting to save the template?
Also, why would it prompt TWICE to save the same template??
Here's the code. Everything is declared, though some of these are declared further up; I have Option Explicit on. full_path_to_renewal_report_word_template is passed in to the function:
![]()
Please Login or Register to view this content.
Bookmarks