Unanswered How to get excel like affect in add-in

  • Saturday, December 10, 2011 8:38 PM
     
     

    Hi -- How to get excel type affect in an add-in created using visual studio. I mean i can get the image and description. However, as shown in the below picture, if i want "Freeze panes" to be bold and then in the next line, want to add some text to that button, how do i do that?

All Replies

  • Sunday, December 11, 2011 2:38 PM
     
     

    You have to do it with two or more steps.  First you have to put the string into the excel cell.  to get the next line you need to add a return.  Then you have to change the font style as shown below

     

        Range("A1") = "Freeze Frames" & Chr(10) & "Keep Rows"
        With Range("A1").Characters(Start:=1, Length:=13).Font
            .Name = "Arial"
            .FontStyle = "Bold"
            .Size = 10
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ColorIndex = xlAutomatic
        End With

    I did the code quickly in VBA, but I can post the code for either VB Net or C#.


    jdweng
  • Sunday, December 11, 2011 8:25 PM
     
     
    Hi -- It looks like you did it for a cell value in excel. However, i want to do somewhat similar to the button label in add-in.
  • Friday, April 13, 2012 11:14 PM
     
     

    Can someone share their experience please?

  • Saturday, April 14, 2012 3:38 AM
     
     

    Did you consider custom dialog boxes?  See these webpages below.  I have not tried this before.

    http://msdn.microsoft.com/en-us/library/aa969773(v=VS.85).aspx

    http://www.codeproject.com/Articles/13426/Custom-Color-Dialog-Box


    jdweng

  • Monday, April 16, 2012 1:16 AM
    Moderator
     
     

    It's very easy :)

    Add a menu to the ribbon and set it's

    ControlSize to RibbonControlSizeLarge

    itemsize to RibbonControlSizeLarge

    Add buttons to the items and set the description to whatever you want.

    See snapshot. I am not adding images to the buttons. I am sure you can do that :)


    Sid (A good exercise for the Heart is to bend down and help another up) Please do not email me your questions. I do not answer questions by email unless I get paid for it :) If you want, create a thread in VB.Net/Excel forum and email me the link and I will help you if I can.