Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8613991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:00:55+00:00 2026-06-12T05:00:55+00:00

I am developing a custom ribbon extension for Excel, in which a control requires

  • 0

I am developing a custom ribbon extension for Excel, in which a control requires different custom images. I managed to use some images located in my filesystem, but I would like to embed these images inside the .xlsm file.
Is it possible to do it and to reference them from the VBA code that updates the image of the control?

For test purposes, this is the XML that defines my custom ribbon:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="ribbonLoaded">
  <ribbon>
    <tabs>
      <tab idMso="TabHome" >
        <group id="customGroup1" label="My Group" insertAfterMso="GroupFont">
          <button id="customButton1" label="Click Me" size="large" onAction="Macro1" getImage="getButtonImage"/>
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

And this is the macro that change the image of the customButton1 control:

Dim imgIndex As Long

Public Sub getButtonImage(ByVal control As IRibbonControl, ByRef Image)
Select Case control.ID
  Case "customButton1"
    Set Image = LoadPicture("img" + Trim(Str(imgIndex)) + ".bmp")
    imgIndex = (imgIndex + 1) Mod 2
  End Select
End Sub

I tried to add the bmp files inside the .xlsm and reference them updating the relationships file (.rels), but I don’t know how to reference them from VBA and most important, when I open the file with Excel and save it, they are automatically deleted…

Any help is appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:00:56+00:00Added an answer on June 12, 2026 at 5:00 am

    If the image is embedded in the customUI, you do not need VBA to add them to a control. Just use the same ID for the image in an image tag:

    <button id="button1" label="Test" size="large" image="TestID" onAction="ButtonOnAction" />
    

    My sample is adressing the image with ID “TestID”, which must be found in the customUI XML – expand the customUI node in the Custom UI Editor to find or change the image ID (or use the editor to add a new image).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a custom widget (inheriting from QWidget) to use as a control. How
I'm developing a custom control, which most resembles a text area. I am drawing
I'm developing a custom control which is a composition of tables and buttons. I
I am developing a custom WPF control and confused how to use the dependency
I'm developing a custom server control in Asp.NET (.NET 3.5) which inherits the CompositeControl
I'm developing a custom DataGridView control for internal use and I'd like to add
I'm developing a custom search control and setting its configuration based on this sample
I am developing a custom shopping cart for which existing customers will need to
I'm developing custom Agent for LotusNotes 8.5. I'd like to use iCal4j jar to
Say you're developing a custom control and there's a key template part that your

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.