How to embed picture on command button

angsuman

New Member
Joined
Aug 19, 2015
Messages
30
Hello All,


I have one userform and I am adding textbox and commandbuttons dynamically to it. Now I want to embed not link a picture on one command button so that picture appears on command button even if picture file is not in its location. I tried creating one userform and adding picture to image control. I used following code after that. It did not work. Need your help to achieve this.


Code:
         With PiBtn
            .Top = TxtBoxTopPos
            .Height = HeightLen * 2
            .Width = CalBtnWidth
            .Left = UformWdth - CalMrgn - CalBtnWidth
            .BackColor = &H8000000F
            .ForeColor = &H80000012
            .Font.Name = "Arial"
            .Font.Size = 9
            .Picture = LoadPicture(PicForm.Image1.Picture)
		End	With


Thanks
Angsuman
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi

You use LoadPicture() to load a picture from a file.

In this case try instead

Code:
With PiBtn
    .Picture = PicForm.Image1.Picture
 
Upvote 0
.
If you use an ActiveX button instead of a CommandButton, you will be able to display an image.
 
Upvote 0
Thank you Logit for your response. I used your suggestion. First I created an user form as supporting user form with picture frame and then added the picture to it. In working user form, I referred to the supporting user form using your suggestion. Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top