Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Picture in a UserForm Howard31 Excel Discussion (Misc queries) 1 December 20th 08 03:27 PM
Picture in spreadsheet to picture in userform? Charlotte E.[_2_] Excel Programming 4 November 22nd 08 10:17 AM
Chart Picture Size in UserForm/Picture Control. Dan Excel Programming 8 May 30th 08 08:04 PM
Userform picture brownti via OfficeKB.com Excel Programming 1 July 17th 07 04:05 PM
How to get a picture on a userform? sebastienm Excel Programming 0 March 26th 06 11:58 PM


All times are GMT +1. The time now is 12:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"