none
TooltipText property of CommandBarButton not working – using VSTO RRS feed

  • Question

  • The above works if the CommandBarButton is on the CommandBar control but not if it is on CommandBarPopup control.

    The Style property of the CommandBarButton on the CommandBar control is set to Office.MsoButtonStyle.msoButtonIconAndCaption; whereas, there is no Style property set for CommandBarButton on the CommandBarPopup control. But that should not make any difference.

    I am using VSTO 2008 for an application level add-in for MS Word 2003.

    Someone else also seems to have similar issue posted here.

    Please help. Thanks.

    Thursday, June 7, 2012 4:32 AM

All replies

  • Hi namwam,

    Would you please show me you snippet for further research?

    T.X.

    Friday, June 8, 2012 2:12 AM
  • Hi T.X.

    The code snippet is as follows:

    The following code correctly displays the TooltipText. Here, oCommandBar is a custom CommandBar control and oCmdBBtn1 is a CommandBarButton control.

    oCmdBBtn1 = (Office.CommandBarButton)oCommandBar.Controls.Add(1, missing, missing, 1, true);
                    oCmdBBtn1.Style = Office.MsoButtonStyle.msoButtonCaption;
                    oCmdBBtn1.Tag = "test1Tag";
                    oCmdBBtn1.Caption = "Test1 caption";
                    oCmdBBtn1.TooltipText = "Test1 TooltipText";

    The following code does NOT display the TooltipText. Here, oCmdBarPopup is a custom CommandBarPopup control that is added to the oCommandBar (a custom CommandBar control described above) and oCmdBBtn2 is a CommandBarButton control.

    oCmdBBtn2 = (Office.CommandBarButton)cmdBarPopup.Controls.Add(Office.MsoControlType.msoControlButton, missing, missing, 8, true);
                    oCmdBBtn2.Style = Office.MsoButtonStyle.msoButtonCaption;
                    oCmdBBtn2.Tag = "Test2Tag";
                    oCmdBBtn2.Caption = "Test2 caption";
                    oCmdBBtn2.TooltipText = "Test2 TooltipText.";
    Thanks.


    • Edited by namwam Friday, June 8, 2012 4:16 AM
    Friday, June 8, 2012 4:16 AM