+ Reply to Thread
Results 1 to 5 of 5

Word prompts to save template

  1. #1
    Registered User
    Join Date
    05-13-2011
    Location
    Bellevue, WA, USA
    MS-Off Ver
    2019
    Posts
    45

    Word prompts to save template

    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.

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Word prompts to save template

    I suspect the template behaviour is due to the links in it being set to update automatically. Changing them to manual update might resolve that. If not, the following should work:
    oDoc.AttachedTemplate.Saved = True
    oDoc.AttachedTemplate = ""
    in place of all your oTemplate-related code. The first line tells Word the template is saved; the second disconnects the document from it.

    I note also that you're resizing the embedded objects post-update. You might be able to obviate the need for that by either:
    a) applying the registry patch described in the post marked as the Answer at https://answers.microsoft.com/en-us/...8-80b2f83739ff ; or
    b) inserting them into Word tables that have a fixed height and width (as per my last post in the above link); or
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    05-13-2011
    Location
    Bellevue, WA, USA
    MS-Off Ver
    2019
    Posts
    45

    Re: Word prompts to save template

    Thanks Paul,

    The links are set to manual update; I verified that. If I double-click on the template file to create a new document from it, the charts do not update.

    I'll try your other ideas; thanks!

    Greg

  4. #4
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Word prompts to save template


  5. #5
    Registered User
    Join Date
    05-13-2011
    Location
    Bellevue, WA, USA
    MS-Off Ver
    2019
    Posts
    45

    Re: Word prompts to save template

    Sorry, didn't know about the cross-posting rule. Due to the urgency of this issue, and not getting a response on my first post of it, I posted wherever it seemed relevant:

    - http://stackoverflow.com/questions/4...-save-template
    - http://www.msofficeforums.com/word-v...tml#post108010
    - http://www.vbaexpress.com/forum/show...040#post354040

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 01-18-2014, 09:32 PM
  2. Bypassing file load/save prompts
    By bertrey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-28-2007, 08:51 AM
  3. Print to pdf and save without prompts
    By Mr Cockles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-07-2006, 04:10 PM
  4. Disable Save & Update Prompts
    By miwarren in forum Excel General
    Replies: 1
    Last Post: 10-14-2005, 10:35 AM
  5. Prompts to save changes when no changes made
    By Cat_in_awe in forum Excel General
    Replies: 5
    Last Post: 08-10-2005, 02:05 AM
  6. Control save prompts in VB code
    By bobcat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-28-2005, 09:05 AM
  7. [SOLVED] Exiting Excel prompts for save
    By MXH in forum Excel General
    Replies: 3
    Last Post: 02-22-2005, 05:06 PM
  8. Save without prompts
    By Jeff in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2005, 12:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1