Userform Image Control

Zakkala

Active Member
Joined
Nov 12, 2004
Messages
254
Hi there,

I have a couple of logos on a worksheet. The users will, on occasion, make changes to the workbook via a userform interface. I would like to replicate the logos on the userform that show on the worksheet.

I have an image control on the userform, but can't work out how to load the picture to it as I only know how to do it when the picture is a separate file - can anyone advise how I do it using a names picture on a worksheet as the source?

Thanks folks.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi, There may be better ways to do this but this worked for me.
In order to place an image from your sheet to a Userform, you first have to save the image to a tempory file. I was not able to do this with a picture , but you can do it with a Chart Object.
Place an empty chart on the sheet, then position the image over the chart, this seems to lock the image in the chart, (Possibly other ways to do this) .
With your "Userform" and its "Image Control" in place, use this code as shown below, in a "Userform Initialize" Event.
NB:- Adjust sheet names to suit.
Code:
Private Sub UserForm_Initialize()
Dim Pic As Chart, Fname As String
  Sheets("sheet35").ChartObjects(1).Select
  Set Pic = Sheets("sheet35").ChartObjects(1).Chart
Fname = ThisWorkbook.Path & "\temp.gif"
Pic.Export Filename:=Fname, filtername:="GIF"

Image1.Picture = LoadPicture(Fname)
End Sub
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,206,971
Messages
6,075,926
Members
446,171
Latest member
Maddogg4Life

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