PDA

View Full Version : Loop through images in frame



MarkNumskull
02-23-2011, 01:49 PM
Hi All,

I have been doing alot of head scratching with this and searching but can't really find anything conclusive so maybe you can help.

I want to write a bit of VBA that will simply loop through all images on a frame and resize them on a mouseover event. I am assuming there is a function available using something like For Each Image in Me.Frame6 etc but i just cannot seem to get anything to work.

To make it a bit more tricky each image has an actual name rather than just image1, image2 etc which would be easy to loop through. Having names such as btnSearch etc means i cannot do this.

Does anybody know how to loop through images on a frame?

Thanks,

Mark

mancubus
02-23-2011, 02:27 PM
an example:


'http://www.vbforums.com/showthread.php?t=294662

Dim c As Control

For Each c In Me.Controls
On Error Resume Next
' If c.Container Is myFrame Then
If c.Container.Name = "Frame1" Then
If Err.Number = 0 Then c.Visible = False
End If
On Error GoTo 0
Next

MarkNumskull
02-24-2011, 01:04 AM
Hi Mancubus,

Will give this ago later on today and see how i get on!

Thanks,

Mark