Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Picture in UserForm
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' -- A. Ch. Eirinberg |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Picture in UserForm
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) On Thu, 18 Dec 2008 16:34:00 -0800, Howard31 wrote: 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' |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Picture in UserForm
Thanks a million Chip, The picture I was trying to load was in fact PNG, I've
converted it to JPG and it loaded! -- A. Ch. Eirinberg "Chip Pearson" wrote: 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) On Thu, 18 Dec 2008 16:34:00 -0800, Howard31 wrote: 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' |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Picture in a UserForm | Excel Discussion (Misc queries) | |||
Picture in spreadsheet to picture in userform? | Excel Programming | |||
Chart Picture Size in UserForm/Picture Control. | Excel Programming | |||
Userform picture | Excel Programming | |||
How to get a picture on a userform? | Excel Programming |