locked
getImage callback to an icon inserted with the MS Custom UI Editor for MS Office in a Excel xlsm (2007) RRS feed

  • Question

  • Hi all,

    with the MS Custom UI Editor I inserted an icon in a excel xlsm. If I use the tag image = "MyIcon" in the customUI.xml this works fine.

    But If try with the getImage callback doesn't...

    I already tried:

    Public Sub CB_getImage(ktrl As IRibbonControl, ByRef retVal)
     Select Case ktrl.ID
      Case "CB_mybutton"
     '  retVal = "MyIcon"
     '  retVal = "MyIcon.ico"
     '  retVal = "\customUI\images\MyIcon"
     '  retVal = "\customUI\images\MyIcon.ico"
     '  retVal = "images\MyIcon"
     '  retVal = "images\MyIcon.ico"
     '  retVal = "customUI\images\MyIcon"
       retVal = "customUI\images\MyIcon.ico"
     Case "CB_AUTORIZADOS"
       retVal = "DirectRepliesTo"
     End Select
    End Sub

    I always get the message:

     Unknown Office control ID: customUI\images\MyIcon.ico

    Is there something I missed or the only way is use the tag in the customUI.xml ??

    João



    Friday, December 28, 2012 8:45 PM

Answers

  • You can not access the imagery stored in the compressed folder via VBA.

    You can return either a imageMso tag, for built-in images, or an IPicture object from an external file or copy of a image stored within the workbook.

    Have a read of Stephen Bullen's chapter on ribbonx.

    http://www.oaltd.co.uk/Spreads/Excel2007VBAProgRef_ch14.pdf

    Alternatively Ron de Bruin's article has details on using an uncompressed copy to extract the image from the CustomUI folders.

    http://www.rondebruin.nl/getimage.htm


    Cheers,

    Andy
    www.andypope.info

    Saturday, December 29, 2012 12:54 PM

All replies

  • You can not access the imagery stored in the compressed folder via VBA.

    You can return either a imageMso tag, for built-in images, or an IPicture object from an external file or copy of a image stored within the workbook.

    Have a read of Stephen Bullen's chapter on ribbonx.

    http://www.oaltd.co.uk/Spreads/Excel2007VBAProgRef_ch14.pdf

    Alternatively Ron de Bruin's article has details on using an uncompressed copy to extract the image from the CustomUI folders.

    http://www.rondebruin.nl/getimage.htm


    Cheers,

    Andy
    www.andypope.info

    Saturday, December 29, 2012 12:54 PM
  • Ok.

    Thanks.

    João
    Monday, December 31, 2012 11:32 AM
  • If you use XL-2010 there you can have customUI compatibility file.

    Regards


    Oskar Shon, Office System MVP

    Press if Helpful; Answer when a problem solved

    Monday, December 31, 2012 1:32 PM
    Answerer
  • Ok.

    I have to use 2007.

    João

    Monday, December 31, 2012 2:46 PM
  • Andy

    by the way...

    your, very good, RibbonX Visual Designer, stop work sometime ago.

    I know that probably is something that was been updated in my workstation...

    Any hints ?

    João

    Monday, December 31, 2012 2:52 PM
  • Check the page for possible causes and resolutions.

    http://www.andypope.info/vba/ribboneditor_2010.htm

    There have been a number of MS updates over the past few months that have caused issues for 3rd party add-ins.


    Cheers,

    Andy
    www.andypope.info

    Monday, December 31, 2012 2:54 PM