Button image

misi01

New member
Joined
Jul 13, 2011
Messages
31
Reaction score
0
Points
0
Location
Stockholm,Sweden
I have the following code in my UI:-

Code:
<button id="Toggle_subtotals" 
        imageMso="OutlineGroup" 
               label="Skapa subtotaler"  
         onAction="update_data_ribbon"/>
When I then open the workbook, I see the following images - as can be seen from the names, I'm expecting the image from the standard ribbon but it's being replaced by a completely different image. 2 questions:-


  1. Is there a (simple) workaround
  2. If not, is there somewhere (maybe) that I can edit the "correct" images and save them as 16x16 ones
 

Attachments

  • Ribbon_image_expected_layout.png
    Ribbon_image_expected_layout.png
    3.2 KB · Views: 329
  • Ribbon_image_wrong_layout.png
    Ribbon_image_wrong_layout.png
    9.9 KB · Views: 11
The filenames weren't attached above. The first image is what I'm seeing whereas the second one shows the image I'd LIKE to see
 
I'm thinking that you're getting the normal size image instead of the large one... probably because it's in a menu. Maybe try defining the image size to large and see if that fixes it. Failing that, you may need to snap a new picture of the icon you want with screen capture software and turning it into a 16x16 image yourself.

Code:
<button id="Toggle_subtotals" 
        imageMso="OutlineGroup" 
        size="large"
               label="Skapa subtotaler"  
         onAction="update_data_ribbon"/>
 
Thanks Ken

I had tried adding the size attribute, but (as you write in your book so often :smile:), I validated the added line and it failed with a message The size attribute is not declared (you have an example in chapter 6, page 177).

I'm guessing that size can't be specified when using getimage/getlabel. (And yes, I also tried with getSize which, if I read table 6-4 correctly, should be allowed, but that failed as well)

Next question - where are all the original 32x32 images ???
 
Wait, you're using a menu control, correct? Try setting the itemSize="large" attribute on the menu (rather than trying to get the button size set) See if that makes a difference.

For the images, here's a couple of links that may help... ImageMSO finder This was for Office 2007, and I don't think it showed everything, but it should give you a bit of a head start.

You may also want to check out this link. It gives all the control ID's for the Office 2007 ribbon commands. If I recall coreclty, the idMSO and the imageMSO were mostly the same.
 
Thanks again

Try setting the itemSize="large" attribute on the menu - that solved that problem (although I would like to have normal icons instead - I'll keep experimenting there)

It gives all the control ID's for the Office 2007 ribbon commands I didn't really understand this (or rather, it's application). If I understand you correctly, then OutlineGroup would be something like Ordering=538 and Policy ID=3159. What do I do with these numbers (if I even should) ?

I think what I'm really (?) after is a method of capturing the "normal" OutlineGroup image and saving it as a 16x16 image. Having said that, even if I manage this, will this mean that I'll have to "package" the PNG's along with the actual xlsm ? One solution I employed using the old 2003 add-in method was to store the image in a cell in a hidden sheet and load it via the following code

Code:
Dim shp As Shape

Set sh = Sheets(technical_sheet_name)   'Change here to the worksheet for shapes
    Set shp = sh.Shapes("English")          ' Select the English flag
    shp.CopyPicture Format:=xlBitmap
    
    With MenuItem.Controls.Add(Type:=msoControlButton)
        .Caption = menu_texts(4)            ' English
        .OnAction = "change_language_english"
        .Tag = "ENGLISH"
        .PasteFace
    End With
Is there some variation on this that is applicable to Ribbons ?

(The attached image shows the results of the above code - plus a few other languages)


ERII_flags.png
 
Sorry, what I meant was the Control Name in the first column of the spreadsheet is often the same as the imageMSO name. Regardless, I don't think that will help you in this instance. The ribbon is built to collapse and use smaller icons if the display isn't wide enough, and that image is the 16x16 version of the 32x32 one you want.

I've attached some images for you... I took a capture of both group/ungroup at 32x32, and resized them to 16x16. If you open your workbook with the customUI Editor, you can upoad these images into your file and use them.

The issue you'll quickly see though, is that at 16x16, they don't look like much!
 

Attachments

  • ungroup_32x32.png
    ungroup_32x32.png
    1.5 KB · Views: 322
  • Group_32x32.png
    Group_32x32.png
    1.4 KB · Views: 321
  • ungroup_16x16.png
    ungroup_16x16.png
    878 bytes · Views: 320
  • Group_16x16.png
    Group_16x16.png
    897 bytes · Views: 321
Thanks Ken. Hmmmm - I think I'll bury the idea of the reduced image sizes after seeing your results.

BTW - what method did you use to reduce from 32x32 to 16x16 (useful if I ever want to do it myself)
 
Thanks - already got Snagit. Will have to read up on the help a bit more there (didn't know you could do that)
 
Back
Top