Results 1 to 13 of 13
  1. #1
    Star Lounger
    Join Date
    Feb 2003
    Location
    near Blairgowrie, Perthshire, Scotland
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    moving a toolbar (Word 2002)

    I have written the following to open the Word Count toolbar when a doc is opened:

    Sub autoopen()
    CommandBars("Word Count").Visible = True
    End Sub

    That plonks it on the top line all by itself - is there a way programmatically to attach it to the front of the Standard toolbar so that it doesn't gobble up an extra line of real estate, please? I know - you can do it manually, but it's a bit of a pain.

    Rex Last

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

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

    Re: moving a toolbar (Word 2002)

    Try this:

    Sub AutoOpen()
    With CommandBars("Word Count")
    .Position = msoBarTop
    .RowIndex = 2 ' Standard toolbar is in 2nd row
    .Left = 0 ' place toolbar at beginning of row
    .Visible = True
    End With
    End Sub

  4. #3
    Star Lounger
    Join Date
    Feb 2003
    Location
    near Blairgowrie, Perthshire, Scotland
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: moving a toolbar (Word 2002)

    Sorry, it doesn't work. The toolbar is still glued to the top line all by itself. Thanks for the swift reply - again.
    I found a workaround that does it for me, i.e. putting the bar MsoBottom and removing the Drawing toolbar which I don't use often. Now it's easier to read and the Alt+C combination updates the word count. Pity it doesn't do it in real time, though.

    Rex Last

  5. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: moving a toolbar (Word 2002)

    I'd be interested to know if the code I posted works for others reading this thread. It works correctly for me in Word 2003.

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

    Re: moving a toolbar (Word 2002)

    It puts the word count toolbar on the top row all by itself for me. Word 2003 SP2.

    StuartR

  7. #6
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: moving a toolbar (Word 2002)

    Thank you Hans
    That has been a minor irritation of mine for some months now.
    Regards
    Don

  8. #7
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: moving a toolbar (Word 2002)

    Hello Hans
    In Word 97 I was able to achieve the desired result by: <pre>Sub TBar()
    CommandBars("GD Macros").Visible = False
    With CommandBars("Menu Bar")
    .RowIndex = 1 'Force Menu Bar to the top
    End With
    With CommandBars("Standard")
    .RowIndex = 2 ' Force Standard toolbar to 2nd row
    End With
    With CommandBars("GD Macros")
    .Position = msoBarTop
    .RowIndex = 2 ' Position GD Macros in front of Standard toolbar
    .Visible = True
    End With
    End Sub
    </pre>

    Regards
    Don

  9. #8
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: moving a toolbar (Word 2002)

    Take a look at <post#=549297>post 549297</post#>
    Regards
    Don

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

    Re: moving a toolbar (Word 2002)

    Hi,

    The solutions mentioned in this thread all places the "new" toolbar, left of the existing ones.
    Personally I would often prefer it to the right.

    I have a workaround where I with a few loops positions the toolbar in "the free space".
    1. loop commandbars collection for .visible=true
    2. then if true, retrieve name, rowindex, width and top

    Now you know exactly what's "in there" and you can position your toolbar at "width+1"
    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

  11. #10
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: moving a toolbar (Word 2002)

    Hi Hans
    As normal, I have managed to confuse myself. Regarding the line
    <hr> .RowIndex = 2 ' Standard toolbar is in 2nd row
    <hr>
    I found that the RowIndex is not consistent between installations of Word. The attached file contains a screen shot of 4 different installations. followed by a list of all visible command bars. The code that generated the listing is provided below. Immediately under the command bar name is the RowIndex followed by the Left position then the width. I can fathom no consistency nor logic in the RowIndex value. Can you offer any insight?
    <pre>Sub bars()
    For i = 1 To CommandBars.Count
    With CommandBars(i)
    If .Visible Then
    Debug.Print .Name
    Debug.Print .RowIndex & " - " & .Left & " - " & .Width
    End If
    End With
    Next
    End Sub
    </pre>


    TIA
    Regards
    Don

  12. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: moving a toolbar (Word 2002)

    My guess (it's no more than that) is that the RowIndex gets reassigned as the user moves toolbars around (on purpose or accidentally), hides them, displays them etc., and that Word itself does not necessarily assign the first available RowIndex to a new toolbar, but possibly a higher number.
    The only thing you can depend on is the order: a larger RowIndex is displayed lower down on the screen than a smaller RowIndex.

    To display a custom toolbar on the same row as the Standard toolbar, regardless of the actual RowIndex of the Standard toolbar:

    CommandBars("My Toolbar").RowIndex = CommandBars("Standard").RowIndex

  13. #12
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: moving a toolbar (Word 2002)

    Thanks Hans
    This thread has been most illuminating.
    Regards
    Don

  14. #13
    Star Lounger
    Join Date
    Feb 2003
    Location
    near Blairgowrie, Perthshire, Scotland
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: moving a toolbar (Word 2002)

    The plot thickens. The following dog's breakfast seems to do the trick. It moves the Standard toolbar to the right, sticks the word count in front of it, then readjusts the positions of the other two. As for wdwells and the RowIndex property, it is really confusing as it is used for CommandBars and Tables.

    Sub AutoOpen()
    '

    ' Macro recorded 1/12/2006 by Rex W Last
    '

    With CommandBars("Word Count")
    .Visible = True
    .Position = msoBarTop
    .Left = 0
    End With
    With CommandBars("standard")
    '.Visible = True
    .Position = msoBarTop
    .Left = 218
    End With
    With CommandBars("menu bar")
    .RowIndex = 0
    .Position = msoBarTop
    .Left=0
    End With
    With CommandBars("formatting")
    .RowIndex = 1
    .Position = msoBarTop
    .Left=0
    End With

    End Sub

    PS I now find the Formatting menu is adrift from the left of the page so I have added .left =0 as belt and bracess

Posting Permissions

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