none
CommandbarControl.Left property in Office 2007 RRS feed

  • Question

  • Hi,

    In office 2003 it was posible to get the position of a Commandbar by using CommandbarControl.Top and CommandbarControl.Left. However this does not seem to work in Office 2007. The width and height appears to still work correctly. For example if I want to know the position of underline in MSWord.

    oWord = new Word.ApplicationClass();
    
    oWord.Visible = true;
    
     
    
    //underline ID 115
    
    Console.WriteLine( oWord.CommandBars.FindControl(1, 115, null,
    
    null).Caption);
    
    
    
    Console.WriteLine(oWord.CommandBars.FindControl(1, 115, null,
    
    null).Width);
    
    
    
    Console.WriteLine(oWord.CommandBars.FindControl(1, 115, null,
    
    null).Height);
    
    
    
    Console.WriteLine(oWord.CommandBars.FindControl(1, 115, null,
    
    null).Top);
    
    
    
    Console.WriteLine(oWord.CommandBars.FindControl(1, 115, null,
    
    null).Left);
    
    

    Output:

    &Underline

    23

    22

    -8

    -8

    Any suggestions on how I can get the Top Left positions would be much appreciated.


    Monday, May 23, 2011 9:51 AM

Answers

  • Hi Phantom

    The toolbars have become more or less irrelevant in Office 2007 / 2010. Office migrated to the Ribbon UI. All toolbars are shown only in the "Add-ins" tab of the Ribbon (a docked position) and you can't control them the same way as you could in previous versions.


    Cindy Meister, VSTO/Word MVP
    Monday, May 23, 2011 10:29 AM
    Moderator

All replies

  • Hi Phantom

    The toolbars have become more or less irrelevant in Office 2007 / 2010. Office migrated to the Ribbon UI. All toolbars are shown only in the "Add-ins" tab of the Ribbon (a docked position) and you can't control them the same way as you could in previous versions.


    Cindy Meister, VSTO/Word MVP
    Monday, May 23, 2011 10:29 AM
    Moderator
  • Hi Cindy,

    Thank you for your reply. I guessed that I may have problems with the Ribbon UI in 2007. Is there another way to get the position and width of the objects within the Ribbon?

    Thanks

    Monday, May 23, 2011 11:00 AM
  • Hi Phantom

    No, there's not. Why is it relevant?


    Cindy Meister, VSTO/Word MVP
    Monday, May 23, 2011 11:29 AM
    Moderator