Ich habe eine Weile im Netz gesucht, bis ich auf einen hilfreichen Artikel gestoßen bin:
https://docs.microsoft.com/de-de/office/vba/api/office.commandbarbutton.picture
Hier ist der kopierte Codeschnipsel, wie ich das Bild eines CommandButtons zur Laufzeit in VBA (Excel) ändern kann:
Sub ChangeButtonImage() Dim picPicture As IPictureDisp Dim picMask As IPictureDisp Set picPicture = stdole.StdFunctions.LoadPicture( _ "c:\images\picture.bmp") Set picMask = stdole.StdFunctions.LoadPicture( _ "c:\images\mask.bmp") 'Reference the first button on the first command bar 'using a With...End With block. With Application.CommandBars.FindControl(msoControlButton) 'Change the button image. .Picture = picPicture 'Use the second image to define the area of the 'button that should be transparent. .Mask = picMask End With End Sub