Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Looping through images on a userform

How can I loop through the images on a userform? Can I add a variable counter
as the numeric part of the default image names image1, Image2 etc? Basically
I want to display multiple (dynamic) charts on a userform, so want to loop
through each image and load it's associated image file (of a chart, which is
saved when the workbook is opened). I could do it the long way by coding each
image to it's graphic file, but was looking for a more elegant solution using
a loop.
Regards and thanks,
Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Looping through images on a userform

Dim im as MsForms.Image
for i = 1 to 10
set im = Userform1.Controls("Image" & i)
Next

--
Regards,
Tom Ogilvy


"Zarch" wrote:

How can I loop through the images on a userform? Can I add a variable counter
as the numeric part of the default image names image1, Image2 etc? Basically
I want to display multiple (dynamic) charts on a userform, so want to loop
through each image and load it's associated image file (of a chart, which is
saved when the workbook is opened). I could do it the long way by coding each
image to it's graphic file, but was looking for a more elegant solution using
a loop.
Regards and thanks,
Mark

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Looping through images on a userform

Fantastic, Many thanks Tom.

Er, next snag - can I auto scale the imported graphic files to fit the image
frames?

Regards,

Mark

"Tom Ogilvy" wrote:

Dim im as MsForms.Image
for i = 1 to 10
set im = Userform1.Controls("Image" & i)
Next

--
Regards,
Tom Ogilvy


"Zarch" wrote:

How can I loop through the images on a userform? Can I add a variable counter
as the numeric part of the default image names image1, Image2 etc? Basically
I want to display multiple (dynamic) charts on a userform, so want to loop
through each image and load it's associated image file (of a chart, which is
saved when the workbook is opened). I could do it the long way by coding each
image to it's graphic file, but was looking for a more elegant solution using
a loop.
Regards and thanks,
Mark

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Looping through images on a userform

Setting the PictureClipSizeMode to fmPictureSizeModeZoom (1)

worked for me although looking at the help would not indicate that it would
do it. So I can't say it will work for every picture. Try it and see. I
did it manually and set it after the picture was loaded using the default of
clipping the picture - don't know if that makes a difference.

If that won't work, then you will need to size it before using the export
method (I assume that is what you are using).



--
Regards,
Tom Ogilvy

"Zarch" wrote:

Fantastic, Many thanks Tom.

Er, next snag - can I auto scale the imported graphic files to fit the image
frames?

Regards,

Mark

"Tom Ogilvy" wrote:

Dim im as MsForms.Image
for i = 1 to 10
set im = Userform1.Controls("Image" & i)
Next

--
Regards,
Tom Ogilvy


"Zarch" wrote:

How can I loop through the images on a userform? Can I add a variable counter
as the numeric part of the default image names image1, Image2 etc? Basically
I want to display multiple (dynamic) charts on a userform, so want to loop
through each image and load it's associated image file (of a chart, which is
saved when the workbook is opened). I could do it the long way by coding each
image to it's graphic file, but was looking for a more elegant solution using
a loop.
Regards and thanks,
Mark

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Looping through images on a userform

Thanks again Tom.

"Tom Ogilvy" wrote:

Setting the PictureClipSizeMode to fmPictureSizeModeZoom (1)

worked for me although looking at the help would not indicate that it would
do it. So I can't say it will work for every picture. Try it and see. I
did it manually and set it after the picture was loaded using the default of
clipping the picture - don't know if that makes a difference.

If that won't work, then you will need to size it before using the export
method (I assume that is what you are using).



--
Regards,
Tom Ogilvy

"Zarch" wrote:

Fantastic, Many thanks Tom.

Er, next snag - can I auto scale the imported graphic files to fit the image
frames?

Regards,

Mark

"Tom Ogilvy" wrote:

Dim im as MsForms.Image
for i = 1 to 10
set im = Userform1.Controls("Image" & i)
Next

--
Regards,
Tom Ogilvy


"Zarch" wrote:

How can I loop through the images on a userform? Can I add a variable counter
as the numeric part of the default image names image1, Image2 etc? Basically
I want to display multiple (dynamic) charts on a userform, so want to loop
through each image and load it's associated image file (of a chart, which is
saved when the workbook is opened). I could do it the long way by coding each
image to it's graphic file, but was looking for a more elegant solution using
a loop.
Regards and thanks,
Mark

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
Looping procedure calls userform; how to exit loop (via userform button)? KR Excel Programming 6 July 27th 05 12:57 PM
Cycle through images on UserForm cdb Excel Discussion (Misc queries) 1 January 28th 05 12:46 AM
Images in Userform? RPIJG[_35_] Excel Programming 2 June 9th 04 05:55 PM
Userform Images nath Excel Programming 1 May 27th 04 12:39 PM
Hide all images on userform Jason Morin[_3_] Excel Programming 3 April 26th 04 09:20 PM


All times are GMT +1. The time now is 10:42 AM.

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"