I need to add an image to a custom toolbar / menu item that is created through VBA.
For a toolbar item, I tried the following code
Set NewBtn = TBar.Controls.Add(Type:=msoControlButton) With NewBtn .Picture = LoadPicture("mypic.bmp") .OnAction = "'MyFunction""" & para1 & """'" //VBA Function '.Caption = "MyFunction" .TooltipText = "MyFunction" .Style = msoButtonCaption End With
In the above code, LoadPicture () does not work. My toolbar is initialized during a workbook load event. I noticed that the image is uploaded to the toolbar button, but in a split second it disappears and only the text of the element is displayed. My image is 16x16 pixels per second.
Any help will help solve this problem.
thanks
nimo source share