Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Looping procedure calls userform; how to exit loop (via userform button)? | Excel Programming | |||
Cycle through images on UserForm | Excel Discussion (Misc queries) | |||
Images in Userform? | Excel Programming | |||
Userform Images | Excel Programming | |||
Hide all images on userform | Excel Programming |