+ Reply to Thread
Results 1 to 5 of 5

display images in random UserForm

  1. #1
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    display images in random UserForm

    Hi.

    I have 30 images in in C:\Users\Public\Pictures\Sample Pictures.

    I have a UserForm with 10 controls (image1, image2 ... img 10)

    I need to create a way to run the 30 images so aletória controls within the images.

    does anyone know how?
    Attached Files Attached Files
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: display images in random UserForm

    Put this code into the FORM module.

    When the form initializes, it pulls a list of ALL the JPG files in the given FPATH directory at the top of the page.

    Then when you click RANDOM, it creates a list of 10 unique random numbers, then pulls the pictures from the array in those numeric positions and displays them. Each time you click you'll get 10 dif pics. This should eliminate duplicate pictures ever showing.

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: display images in random UserForm

    It was great!!
    But I still need more help.
    I'll explain in the folder I mentioned will have these 80 pictures named 1-30 and 50 numbered 31-80 who are part of another routine, this routine he has to get the images named only 1-30 and he is taking all the pictures.

    The name of each picture is (1, 2, 3 ... 30)

    thank you!!!!!!!!!!!!!!!!!!!!

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: display images in random UserForm

    Yeah, I'm going to tell you to put pictures for separate uses into separate folders. That way you can update this by simple adding/removing pics from any one folder.

  5. #5
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: display images in random UserForm

    Hi
    i'm very happy
    Thank you!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1