Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Loop through image controls on worksheet

Ah. That seems like a reasonable thing to try.

If you're working with pictures, you may want to use http://www.irfanview.com.
It's a nice picture viewer with lots of features. You can make a pdf file of
thumbnail sized pictures.

And http://picasa.google.com may be of use if you want a free basic photo
editor/organizer.

Paul Mathews wrote:

Hi Dave, yes you're right, this is a pretty darned strange thing to do.
Let's call it an experiment at this point. I guess it's best described as
something of an Excel photo viewer (i.e., click a forward or back button and
see pictures change on a worksheet as well as text; the text and picture file
names are sourced from a data table in another worksheet). I may well end up
doing the standard insertion of pictures from files into the worksheet but I
was curious about this approach (image controls do have the nice feature of
providing automatic sizing of a loaded picture using the PictureSizeMode
property). Thanks again for indulging me.

"Dave Peterson" wrote:

I don't normally put image controls on worksheets. I just plop the pictures
where I want them.

Is there a reason you don't use the plain old pictures?

Just curious.

Paul Mathews wrote:

Dave, Joel, thank you both very much. Dave, the code you provided is
precisely what I was looking for (I couldn't quite figure out how to use the
OLEObjects method so that I could specify a string name for each image
control and you nailed it with your solution). I appreciate the time you
took to provide this solution to me and the rest of the Excel community.

Paul Mathews

"Dave Peterson" wrote:

Option Explicit
Sub testme()
Dim iCtr As Long
For iCtr = 1 To 3
Sheet1.OLEObjects("Image" & iCtr).Object.Picture _
= LoadPicture("c:\pict" & iCtr & ".jpg")
Next iCtr
End Sub

Paul Mathews wrote:

I'm attempting to set the picture property of several image controls on a
single worksheet (not on a user form). For example, three image controls
(named Image1, Image2, and Image3) on Sheet 1:

Sheet1.Image1.Picture = LoadPicture("C:\Pic1.jpg")
Sheet1.Image2.Picture = LoadPicture("C:\Pic2.jpg")
Sheet1.Image3.Picture = LoadPicture("C:\Pic3.jpg")

Can anyone suggest a way to set the picture property for each image by
looping rather than repeating the loadpicture for each image as above?
Thanks in advance.

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
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
Image Controls Sandy[_6_] Excel Programming 2 July 2nd 05 08:15 PM
Image and WebBrowser Controls JT[_2_] Excel Programming 2 September 17th 04 08:44 PM
Image Edit and WebBrowser controls JT[_2_] Excel Programming 0 September 17th 04 06:54 PM
Loop through objects/controls on worksheet Tom V Excel Programming 2 September 16th 04 06:09 PM
Bmp vs Gif in Userform image controls Sandy-V[_2_] Excel Programming 0 January 14th 04 01:46 PM


All times are GMT +1. The time now is 03:30 PM.

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

About Us

"It's about Microsoft Excel"