Results 1 to 10 of 10

Thread: Button image

  1. #1
    Acolyte misi01's Avatar
    Join Date
    Jul 2011
    Location
    Stockholm,Sweden
    Posts
    31
    Articles
    0

    Button image



    Register for a FREE account, and/
    or Log in to avoid these ads!

    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
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Ribbon_image_wrong_layout.png 
Views:	5 
Size:	9.9 KB 
ID:	155  
    Attached Images Attached Images  

  2. #2
    Acolyte misi01's Avatar
    Join Date
    Jul 2011
    Location
    Stockholm,Sweden
    Posts
    31
    Articles
    0
    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

  3. #3
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,089
    Articles
    79
    Blog Entries
    14
    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"/>
    Ken Puls, FCPA, FCMA, MS MVP (Excel)

    Master your data with Power Query: Purchase your copy of my book M is for Data Monkey today!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  4. #4
    Acolyte misi01's Avatar
    Join Date
    Jul 2011
    Location
    Stockholm,Sweden
    Posts
    31
    Articles
    0

    Thanks Ken

    I had tried adding the size attribute, but (as you write in your book so often ), 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 ???

  5. #5
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,089
    Articles
    79
    Blog Entries
    14
    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.
    Ken Puls, FCPA, FCMA, MS MVP (Excel)

    Master your data with Power Query: Purchase your copy of my book M is for Data Monkey today!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  6. #6
    Acolyte misi01's Avatar
    Join Date
    Jul 2011
    Location
    Stockholm,Sweden
    Posts
    31
    Articles
    0

    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)


    Click image for larger version. 

Name:	ERII_flags.png 
Views:	9 
Size:	5.3 KB 
ID:	158

  7. #7
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,089
    Articles
    79
    Blog Entries
    14
    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!
    Attached Images Attached Images        
    Ken Puls, FCPA, FCMA, MS MVP (Excel)

    Master your data with Power Query: Purchase your copy of my book M is for Data Monkey today!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  8. #8
    Acolyte misi01's Avatar
    Join Date
    Jul 2011
    Location
    Stockholm,Sweden
    Posts
    31
    Articles
    0
    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)

  9. #9
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,089
    Articles
    79
    Blog Entries
    14
    Screen capture using SnagIt & scaled it in their editor

    Sent from my LG-E900h using Board Express
    Ken Puls, FCPA, FCMA, MS MVP (Excel)

    Master your data with Power Query: Purchase your copy of my book M is for Data Monkey today!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  10. #10
    Acolyte misi01's Avatar
    Join Date
    Jul 2011
    Location
    Stockholm,Sweden
    Posts
    31
    Articles
    0
    Thanks - already got Snagit. Will have to read up on the help a bit more there (didn't know you could do that)

Posting Permissions

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