Results 1 to 9 of 9
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Command bar affects Normal.dot? (Word2000)

    Does it help if you set CustomizationContext to the MRUse template?

    Dim i As Integer
    For i = 1 To Templates.Count
    If Templates(i).Name = "MRUse.dot" Then
    CustomizationContext = Templates(i)
    Exit For
    End If
    Next i

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command bar affects Normal.dot? (Word2000)

    <P ID="edit" class=small>(Edited by chrisgreaves on 27-Aug-08 06:59. I ran a "(later)" test.)</P>Hans, thanks for the fast response.
    The short answer to your probe is "No".<pre> Debug.Print Application.NormalTemplate.Saved
    Dim blnSaved As Boolean
    blnSaved = Application.NormalTemplate.Saved

    Dim i As Integer
    For i = 1 To Templates.Count
    Debug.Print i & vbTab & Templates(i).Name
    If Templates(i).Name = "MRUse314.dot" Then ' note file name
    CustomizationContext = Templates(i)
    Exit For
    End If
    Next i

    CommandBars("MRUse").Controls("MRUList").Clear
    Debug.Print Application.NormalTemplate.Saved</pre>

    yields me <pre>True
    1 PDFMaker.dot
    2 MRUse314.dot
    False</pre>

    (The initial pass failed. The template file is MRUse314.dot; I use a version number as part of the file name.
    The VBE Project Explorer window shows "MRUse(MRUse314)".
    FWIW in my code, today, I have replaced by usual string constants with literals,
    solely to make visibly sure that I'm referring to a specific command bar and control.)

    In a few minutes I'm going to experiment in Word2003.

    (later)Almost the same result in Word2003. The PDFMaker wasn't picked up.<pre>True
    1 MRUse314.dot
    False</pre>


  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Command bar affects Normal.dot? (Word2000)

    Are you sure that the toolbar belongs to the MRUsennn].template?
    I repeated your experiment:

    - I created a new template.
    - I created a custom toolbar in the template.
    - I added a combo box and populated it, taking care to use the template as customization context.
    - I saved the template in Word's startup folder as MRUse314.dot
    - I quit and restarted Word. The template was loaded as an add-in and the toolbar was displayed.
    - I created a blank document and copied your macro into it.
    - I ran the macro. the combo box was cleared. Result in the Immediate window:

    True
    1 Utils.dot
    2 MRUse314.dot
    True

    (Utils.dot is an add-in of my own)

    This makes me think that your toolbar belongs (perhaps partly?) to Normal.dot.

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command bar affects Normal.dot? (Word2000)

    >Are you sure that the toolbar belongs to the MRUsennn].template?
    Since you ask (grin) "No".
    But I'm running out the door, so I'll probably try rebuilding in a few hours.
    Thanks for the nudge.

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command bar affects Normal.dot? (Word2000)

    (Apologies for the delay; I should have learned by now not to take two days off ...).
    I emptied my Startup Folder.
    I renamed my Normal.dot.
    I loaded Word with an obviously new Normal.dot (all the Standard toolbars in place).
    I created a new template (File, new, template) and got this!

    I suspect my system is corrupted.
    Next time I'll take the cat with me (wanders off to find the Office2000 CD ....)
    Attached Images Attached Images

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Command bar affects Normal.dot? (Word2000)

    I'm struggling to understand this on two counts, the second count being that the VBA Help screens for
    "CommandBarControls Collection Object" and "CommandBarControls Collection Object" don't seem to point me to a Clear method.

    The template project is "MRUse"; it owns a command bar which contains a drop-down list box.
    I re-build the listbox when MRUse is loaded, by clearing the listbox and re-adding the current entries to the list box.
    The code sample below indicates "True" followed by "False".
    I can't understand why changing the contents of a list box control on a command bar in a named project
    should effect a change in my Normal.dot.
    <pre> Debug.Print Application.NormalTemplate.Saved
    CommandBars("MRUse").Controls("MRUList").Clear
    Debug.Print Application.NormalTemplate.Saved</pre>

    My workaround is to test the status prior to clearing the listbox, and restore it if necessary,
    but I'm still left with a puzzle as to why this should trigger a change in Normal.dot.
    <pre> Dim blnSaved As Boolean
    blnSaved = Application.NormalTemplate.Saved
    CommandBars("MRUse").Controls("MRUList").Clear
    If blnSaved Then
    Application.NormalTemplate.Saved = True
    Else
    End If
    </pre>


  7. #7
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command bar affects Normal.dot? (Word2000)

    (later)
    I refuse to let Microsoft take advantage of my time by re-installing Office 2000 so I performed the time-honored traditional
    "<font color=blue>deleting of the data keys</font color=blue>", always a favorite pastime at this, or any other time of the year.
    To be on the safe side I deleted the data keys for 8.0, 9.0 and 11.0.
    So here I am, no Startup, New Normal.dot, empty Data keys.
    Everything works as it should.
    I blame it all on corrupted data keys.

    To test, I wrote the macro as a creation macro.
    1. <LI>I loaded Word, played with the toolbar, saved with changes and exited Word.
      <LI>I loaded Word, deleted the toolbar, saved with changes and exited Word.
      <LI>I loaded Word, created the toolbar, saved with changes and exited Word.
    [list=1]
    At no time was I prompted to save changes to Normal.dot.

    <pre>Sub test()
    CustomizationContext = ThisDocument
    Dim cbar As CommandBar
    Set cbar = ThisDocument.CommandBars.Add("MRUse")
    cbar.Visible = True
    Dim ctl As CommandBarComboBox
    Set ctl = cbar.Controls.Add(msoControlComboBox)
    ctl.Caption = "MRUList"
    ctl.AddItem ("one")
    ctl.AddItem ("two")
    ctl.AddItem ("three")
    End Sub</pre>


    Thanks again, Hans, for corroborating my logic.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Command bar affects Normal.dot? (Word2000)

    Glad you were able to solve it without having to resort to reinstalling Office.

  9. #9
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Command bar affects Normal.dot? (Word2000)

    >Glad you were able to solve it without having to resort to reinstalling Office.
    I'm holding my fire; I realised after deleting Data a week or so ago that I had neglected to turn back ON "prompt to save changes to Normal.dot", so i wasn't seeing the prompt for the wrong reason.
    I don't mind re-installing office; I rather like to re-install Windows every 9-12 months after a reformat. It's about time ...

Posting Permissions

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