Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    CommandBar RowIndex (Word XP)

    I'm attempting to make a note of Command Bar layout so that it can be duplicated in a later session of Word. Thinking only about the Top position, my code reports that the Menu Bar is row 1, Standard is row 2 and Formatting is row 3. No surprises. But the toolbar positioned below Formatting returns RowIndex = 10; below that is 11, and so on.

    The returned values appear to be 1, 2, 3, 10, 11. But after working in Word for a while and moving toolbars around, the same configuration sometimes returns 1, 2, 3, 11, 12. Similarly with Command Bars at the bottom of Word; Drawing is usally row 2 (I have yet to find a Row 1), but sometimes the RowIndex returns 3, even when Drawing is the only comand bar at the bottom.

    When setting the RowIndex, I seem to have better luck with 4 as the RowIndex below Formatting. 10, 11, etc. work, but not as well. Therefore, If I make a note of the returned values, I might have 11 and 12 for the rows below Formatting. But a just-launched session of Word has trouble when I use these values because there's no 10.

    Is there some logic whereby I can know that 10 and 4 indicate the same row, but under other circumstances 11 and 4 are the row below row 3?

    Thanks,
    Richard Barrett

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

    Re: CommandBar RowIndex (Word XP)

    I don't think there is a fixed pattern, it depends on how you have showed and hidden command bars in the past (currently, Menu Bar, Standard and Formatting are 3, 4 and 5 in my version of Word).

    I think you'll have to loop through the collection of CommandBars and fill an array with the names and row indexes of the visible ones (Visible = True), then use that information if you want to manipulate the row indexes.

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Re: CommandBar RowIndex (Word XP)

    Thanks. I think the trick is to determine which command bars share the same row. Say, for example, custom command bars "Apple", "Orange" and "Banana" all return rowindex = 12 in my session of Word where I've been working for several hours. In a new sessions of Word, if I position the 3 of them in row 12, they'll go to rows 5, 6 and 7. Apparently, until there really is a row 12, Word considers row 12 to be the last row + 1.

    msoBarRowFirst (or Last) appears to be useful when setting the bars, but not in reading the current row index.

    So, loop through the collection of CommandBars and fill a multi-element array where CB(1, 1) = CBName and CB(1,2) = CBRow.... and then sort by element 2. Is that what you're suggesting?

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

    Re: CommandBar RowIndex (Word XP)

    Yes, that was my idea.

  5. #5
    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: CommandBar RowIndex (Word XP)

    I haven't read your requirements carefully, but I created a pair of macros (save, restore) for use in Outlook. With a bit of editing, might work in Word. See <post:=343,644>post 343,644</post:>.

  6. #6
    5 Star Lounger
    Join Date
    Mar 2001
    Location
    New York, NY
    Posts
    922
    Thanks
    2
    Thanked 12 Times in 11 Posts

    Re: CommandBar RowIndex (Word XP)

    Thank you. I'll have a look at your code and see if it suits my purposes in Word.

Posting Permissions

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