Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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
    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Templates, save changes (W2K, O2K pro-UK)

    I'd be offering wild guesses for all of these except the workaround. There I'm guessing a bit less. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    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?

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Denmark
    Posts
    347
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Templates, save changes (W2K, O2K pro-UK)

    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
    Bests,
    RD


    PS: Wish there were a knob on the TV to turn up the intelligence. There's a knob called "brightness," but that doesn't work

  4. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Templates, save changes (W2K, O2K pro-UK)

    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

  5. #5
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Templates, save changes (W2K, O2K pro-UK)

    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("XXX X").Context).Saved
    <font color=448800>' Manipulate the toolbar here</font color=448800>

    Application.Templates(Application.CommandBars("XXX X").Context).Saved = blSaved

    StuartR

  6. #6
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Templates, save changes (W2K, O2K pro-UK)

    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. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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