Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Jul 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Added custom toolbar...now word acting stupid! (XP)

    I added a custom toolbar to a word template that is protected for forms... now every time the user opens up a blank form from the template, and then closes it, word asks if they wich to save changes to the template.

    When i take out the code for the custom button, this doesn't happen...

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Added custom toolbar...now word acting stupid! (XP)

    Do you have any auto macros running on the template?

    Is the code you remove acting on the custom button to change its state?

    Something is happening to the template to set it as dirty so you need to audit the file to work out where the change is being applied.

    Perhaps you will need to post the template so we can have a look at it.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    New Lounger
    Join Date
    Jul 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Added custom toolbar...now word acting stupid! (XP)

    I will post the template....

    Note the toolbar which appears at the bottom with a single icon ("protect form"). The code for this is causing word to prompt me to save changes to the template each time the user closes the form.
    Attached Files Attached Files

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

    Re: Added custom toolbar...now word acting stupid! (XP)

    Adding a statement changing the template's Saved state to True appears to do the trick:

    <pre>Sub ProtectButton()
    Set newBar = CommandBars.Add(Name:="Custom2", _
    Position:=msoBarBottom, Temporary:=True)
    newBar.Visible = True
    Set con = newBar.Controls.Add(Type:=msoControlButton, ID:=225)
    con.FaceId = 225
    ActiveDocument.AttachedTemplate.Saved = True
    End Sub
    </pre>

    Just wondering: why are you doing this programatically? - you could for example, use the Tools > Customize interface, while working in the template, to manually create a toolbar and button (although you might then want to have code that runs when documents based on the template open and close, to enforce the show/hide the toolbar).

    Gary

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

    Re: Added custom toolbar...now word acting stupid! (XP)

    The change you are making to the template is to add this toolbar.

    You don't need to add the toolbar to the template in the AutoNew module. It should be added once, by you, at design time.

    StuartR

Posting Permissions

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