Picture in UserForm

  • Thread starter Thread starter Howard31
  • Start date Start date
H

Howard31

Hi All,

I'm having trouble getting a picture into a picture control in a userform.
Every time I select a picture file for the control I get a error message,
something like 'Picture file is not valid'
 
What picture format are you using? I don't think that you can use PNG
files. GIF and JPG work fine. E.g.,

Drag an Image control on to your form and then use code like

Private Sub CommandButton1_Click()
Dim FileName As String
Dim Pict As stdole.StdPicture
FileName = "C:\CPearsonWeb\Images\alerter1.jpg"
Set Pict = New stdole.StdPicture
Set Pict = LoadPicture(FileName)
UserForm1.Image1.Picture = Pict
End Sub

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
Thanks a million Chip, The picture I was trying to load was in fact PNG, I've
converted it to JPG and it loaded!
 
Back
Top