• Templates, save changes (W2K, O2K pro-UK)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Templates, save changes (W2K, O2K pro-UK)

    Author
    Topic
    #389102

    Hi,

    Recently I’ve experienced some odd behaviour in one of my templates…

    I have some templates that creates new documents through the .add method
    The template attached is “MyTemplateMaster.dot”
    (Toolbars are modified by the “MyTemplateMaster.dot” during the doc creation)

    I get two different kinds of questions when I save the document or tries to close it
    1. Do you want to save changes to the “MyTemplateMaster.dot? ” (usually on close)
    2. Do you want to save changes to the document template ? (both on close and first save)

    Question 1 I usually manage to suppress by setting .savechanges=true at the “onClose” event.

    However, recently question 2 has also started to appear, but this happens only at the first save of the document – never subsequently.

    Would anyone know the full explanation to this behaviour?
    – is there a sort of “onFirstSave” event ?

    What is the distinction between the two questions ?
    – that is, if there is a such, also their implications and potential work-arounds ?
    (to me it seems that the source for these questions – must be that they originates from different places in the program code)

    Thanks and best regrads,
    ;o)) Henrik

    Viewing 1 reply thread
    Author
    Replies
    • #686174

      I’d be offering wild guesses for all of these except the workaround. There I’m guessing a bit less. smile

      Before changing the commandbars, set the CustomizationContext to the document for which you want the commandbars customized. This should avoid changing the template, but will store customizations in the document itself, which, if you want to centralize code, is not the most desirable situation. Maybe you could try to make the changes temporary (this is a parameter when adding a new commandbar, not sure about a control)? Does this avoid the “save changes” question?

      • #686256

        Hi, thanks for the reply.

        Maybe my first description was a bit unclear or not quite detailed enough.

        I have a menupoint with a single “START” item in the standard bar, it is launched from a startup path setting. (Tool-Options)
        When the template launches and “.add” a new doc it replaces the “START” with a full menu, where temporary=true
        (so… I need to have the bar on an application level – not activedoc. – this means that normal.dot and “MyMaster.dot” will be modified. But I’ve had no problem suppressing and controlling these so far)

        What puzzles me is the difference and the consequences of the questions, though I believe they relate to the same template, but must have different origins.

        Why does it sometimes use the templates full name (eg. “MyTemplateMaster.dot”) and sometimes only the “document template.dot” name ?
        – and why is “document template” only used “onFirstSave” – not subsequent save operations…? (and again – what are the effects of my answers to these questions – where are they stored ??)

        Did this make it any clearer ??

        BR
        ;o)) Henrik

        • #686454

          Henrik,

          Don’t know the answer either, but was just wondering: do you have any application-level event procedures (such as DocumentBeforeSave) running, in addition to the document-level Document_Close in the template?

          If that were the case, the warnings might be getting triggered by two different events, which might account for the differences between the warnings.

          Gary

        • #688878

          I’m a little late on this thread & I’m not a VBA expert. However, I’ve noticed that if I modify a template by opening it while it is also global (either because it’s in the startup folder or loaded as an add-in), I get prompted twice. I get prompted when I close a document & again when I’m closing Word. I’ve always assumed that it’s because the template is listed twice in the list of templates (Alt+F8 & then check the drop down “look in” box)…once as a template & once as a global template. I’m not sure whether this observation helps or not. smile

    • #686575

      I have some code that changes the state of buttons on a toolbar. I don’t want the template saved every time my code is run so I check the .Saved state of the template before manipulating toolbars and restore the original setting afterwards.

      The code looks something like this (XXXX is the name of the toolbar)

      Dim blSaved As Boolean
      blSaved = Application.Templates(Application.CommandBars(“XXXX”).Context).Saved
      ‘ Manipulate the toolbar here

      Application.Templates(Application.CommandBars(“XXXX”).Context).Saved = blSaved

      StuartR

    Viewing 1 reply thread
    Reply To: Templates, save changes (W2K, O2K pro-UK)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: