+ Reply to Thread
Results 1 to 4 of 4

Userform Image: how to restore original pic?

  1. #1
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Userform Image: how to restore original pic?

    I have an image box in a userform. It is supposed to contain a User Profile Pic. By default it has a silhouette of a "person".

    profile.jpg

    As the user navigates to different people, the image box will change picture to a filename: .picture = loadpicture(filename). However, if no profile picture has ever been configured for that user, I want the silhouette of the "person" to appear, so users will know the box is supposed to contain a profile pic.

    How to do this?

    I dynamically change the pic using:

    imagebox.picture = loadpicture(filename). So if the person is not configured with a picture file, then filename = "". Can I do something like this:

    Please Login or Register  to view this content.
    ??? This obviously doesn't work, or I wouldn't come here.

    I don't want the default pic to point to a file location, because the .xlsm file is supposed to be shareable, and the user may not have the default profile pic in the right folder structure. So what I want is that when the userform loads, I store the default pic somewhere, then when the selected person has no profile pic, then I set: imagebox.picture = DefaultPic

    Please help. Thanks!
    Last edited by superlative; 11-07-2019 at 12:40 AM.

  2. #2
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: Userform Image: how to restore original pic?

    I solved this by creating a second image, and making it invisible.

    Then when I want to load up the default pic, I do:

    imagebox.picture = picdefault.picture

  3. #3
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Userform Image: how to restore original pic?

    FYI, you don't need another control. You can just load the original picture into a variable:

    Please Login or Register  to view this content.
    and then reset it whenever you need to, using:

    Please Login or Register  to view this content.
    Rory

  4. #4
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: Userform Image: how to restore original pic?

    Thanks Rorya! I was trying to figure out what the data type was!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How do I restore original Pivot Table data?
    By Andrew C in forum Excel General
    Replies: 8
    Last Post: 12-14-2016, 03:14 AM
  2. [SOLVED] Using a Userform to Browse image file then paste selected image to sheet?
    By matrixpom in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-05-2015, 05:42 PM
  3. [SOLVED] How to apply Image borders to an image that my excel vba userform pastes in a word doc?
    By CaptainCool in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-11-2014, 05:40 PM
  4. Restore to original view after mailing a range as attachment to Outlook
    By knevil in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-13-2013, 05:41 PM
  5. [SOLVED] Open a userform from a userform, but preserve the info in the original userform
    By jfoerch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2013, 02:38 PM
  6. Replies: 2
    Last Post: 01-08-2013, 09:20 AM
  7. [SOLVED] How do I restore my original excel settings to default?
    By Patsy in forum Excel General
    Replies: 1
    Last Post: 02-13-2005, 10:08 PM

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