![]() |
Embed Image in Add-In
Can anyone give me some pointers on how to embed images in an Excel add-in so
that I can use them as ControlButton images? I currently use bitmap images saved to the same folder as the add-in, but I want to make the add-in more portable by embedding the images in the add-in itself. Thanks. |
Embed Image in Add-In
Jim:
I hadn't heard of the ImageList control before now, but it looks like it may be a suitable solution. http://msdn.microsoft.com/library/de...istcontrol.asp That's a link to the MSDN page on the ImageList control specifically mentioning its use as a repository for icon images. I'll keep you updated on my progress. Thank you for your help. |
Embed Image in Add-In
Various ways, store or images on other images controls, hidden on main form,
or on a dummy form like an ImageList, or worksheet controls on a sheet in your addin - Hidden images on your main form Set Me.CommandButton11.Picture = Me.Controls("hidden_image1").Picture - Dummy form used like an ImageList Dim frm As UserForm Set frm = UserForm2 Load frm Set Label2.Picture = frm.Controls("Image1").Picture ' Set Label2.Picture = frm.Controls(1).Picture ' Set Label2.Picture = frm.Image1Picture Unload frm - Worksheet controls on a sheet in your addin could set a ref to all oleObjects on the sheet Dim mOles as Oleobjects ' at module level in the Initialize event Set mOles = thisworkbook.Worksheets(1).OleObjects 'where needed Set Me.Label1.Picture = mOles("ole_name").Object.Picture To remove a picture from your control Set Me.Label.Picture = Nothing Which of the above methods might depend on the number and total file sizes of images, each have pros & cons, eg Hidden controls on main form is simplest but could impact form load time Dummy ImageList form is nice 'cos you can lay out all your images on the dummy and tab between forms to look what you've got while developing. Worksheet image controls - best for large number / file size but also fine for small qty Regards, Peter T "Lazzaroni" wrote in message ... Can anyone give me some pointers on how to embed images in an Excel add-in so that I can use them as ControlButton images? I currently use bitmap images saved to the same folder as the add-in, but I want to make the add-in more portable by embedding the images in the add-in itself. Thanks. |
Embed Image in Add-In
Using a UserForm to store the images worked the easiest and best for me. As
Peter mentioned, you can arrange the images in the form for easy reference, and if you use Labels instead of Image controls, you can actually label the pictures easily as well. The best part is that the images are preloaded and easy to refer to, especially if you take care to name the label to give some indication of what image it contains. Thanks so much for your help. |
All times are GMT +1. The time now is 12:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com