Consulting

Results 1 to 3 of 3

Thread: Loop through images in frame

  1. #1

    Loop through images in frame

    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

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    an example:

    [VBA]
    '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
    [/VBA]
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  3. #3
    Hi Mancubus,

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

    Thanks,

    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •