Results 1 to 8 of 8

Thread: Can resources embedded in Ribbon CustomUI\images be used elsewhere?

  1. #1
    Seeker Mr Axolotl's Avatar
    Join Date
    Apr 2012
    Location
    Central Europe
    Posts
    7
    Articles
    0

    Can resources embedded in Ribbon CustomUI\images be used elsewhere?



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

    I have been adding my own custom images to the CustomUI\images subdirectory. These are typically .png files and are used in the ribbon in the usual way.

    Suppose I need the same image files elsewhere in the same application, but to be accessed from VBA. Perhaps a logo, or maybe country flags for use in a tree view control, or something. Is there a way to access these image resources from VBA, conceptually opposite to "Loading Custom Pictures On-the-Fly" (p.268, RibbonX book)?

    What appeals to me about the new Office 2007-2010 formats is that they are self-contained. It would be useful to be able to park images and possibly other resources in the CustomUI.

    Thanks, Mr Axolotl

  2. #2
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,294
    Articles
    57
    Blog Entries
    14
    Excel Version
    Excel Office 365 Insider
    Hmm... good question... I'd have to experiment with that one, as I'm not sure off the top of my head how to get to them.
    Ken Puls, FCPA, FCMA, MS MVP

    Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book M is for Data Monkey, or our new Power Query Recipe cards!

    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.

  3. #3
    Seeker Mr Axolotl's Avatar
    Join Date
    Apr 2012
    Location
    Central Europe
    Posts
    7
    Articles
    0
    Thanks by the way for the RibbonX book. VERY useful.

  4. #4
    Acolyte Andy Pope's Avatar
    Join Date
    Mar 2011
    Location
    London, England
    Posts
    41
    Articles
    0
    Excel Version
    2016
    I don't think there is a way, within the existing OM, to access any of the ribbonx content of the open file.

    That said you can work around those limitations. This example creates a temporary copy of the workbook in order to extract the required information.

    The workbook adds a new tab to the ribbon with 3 buttons. Clicking a button will copy the associated image on to the activesheet.

    If you workbook is large this may not be a suitable approach. Instead it might be better to duplicate the imagery on a hidden worksheet.

    RibbonItems.xlsm
    Cheers
    Andy

    www.andypope.info

  5. #5
    Seeker Mr Axolotl's Avatar
    Join Date
    Apr 2012
    Location
    Central Europe
    Posts
    7
    Articles
    0
    Thanks. Nice approach.

    I'll play around with the code and see if I can refine the solution to create a temporary directory (not unlike the ~$addin.xlam files created by Excel) which exists just for the duration of the session containing only the necessary files.

  6. #6
    Why don't you store the .png files in the workbook directory instead of loading them in the CustomUI and use the GDI load to load them dynamically (all explained in the RibbonX book). You can then load them in your application as required.

  7. #7
    Seeker Mr Axolotl's Avatar
    Join Date
    Apr 2012
    Location
    Central Europe
    Posts
    7
    Articles
    0
    Thanks for the reply and suggestion.

    First, I need to do something similar in Word.

    Second, I want to share the images with the ribbon itself, then use them again in a tree view. For the tree view, the images need to be saved on disk somewhere.

  8. #8
    Which is exactly what I suggested.

Tags for this Thread

Posting Permissions

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