+ Reply to Thread
Results 1 to 8 of 8

code won't display a selected image from a file picker, in a user form Any ideas?

Hybrid View

  1. #1
    Registered User
    Join Date
    02-12-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    68

    code won't display a selected image from a file picker, in a user form Any ideas?

    Hi! Does anyone know why this code won't display a selected image from a file picker, in a user form?


    Private Sub ImgProfile_Click()
    With Application.FileDialog(msoFileDialogFilePicker)
    .AllowMultiSelect = False
    .ButtonName = "Submit"
    .Title = "Please Select an Image of a Student"
    .Filters.Add "Image", "*.bmp, *.jpeg", 1
    
    If .Show = -1 Then
        
        Me.Image1.PictureSizeMode = fmPictureSizeModeStretch
        Me.Image1.Picture = LoadPicture(.SelectedItems(1))
    Else
        MsgBox "No image selected"
    End If
    End With
    
    
    End Sub

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: code won't display a selected image from a file picker, in a user form Any ideas?

    Works fine for me.

    Is the code actually being executed?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-12-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: code won't display a selected image from a file picker, in a user form Any ideas?

    Oh i've solved the problem, i turn off auto size. do you know have to resize the image when its uploaded???
    Last edited by jakeembx; 01-09-2014 at 02:34 PM.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: code won't display a selected image from a file picker, in a user form Any ideas?

    I'm using Windows 8 too.

  5. #5
    Registered User
    Join Date
    02-12-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: code won't display a selected image from a file picker, in a user form Any ideas?

    Oh i've solved the problem, i turn off auto size. do you know have to resize the image when its uploaded??? Sorry windows 8!

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: code won't display a selected image from a file picker, in a user form Any ideas?

    You could try setting the appropriate properties after the image has been loaded.

  7. #7
    Registered User
    Join Date
    02-12-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: code won't display a selected image from a file picker, in a user form Any ideas?

    oh something like below, or do you have to have a particular sized image for the image you want it to be?
    me.Image1.Picturesize = Width:=100, Height:=100

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: code won't display a selected image from a file picker, in a user form Any ideas?

    I was thinking more of setting AutoSize to True, though if you are going to be working with images of various sizes it might be an idea to set the height/width so it can accomodate them all.

+ 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. plze helps me for use of date picker on user form
    By shamasdeen01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-22-2013, 04:00 AM
  2. Display selected value from the user form in a specific cell
    By vignesh805 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-08-2013, 07:32 AM
  3. Date Picker from user form
    By Denzil in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-07-2008, 04:28 AM
  4. Date Time Picker in User Form
    By matpj in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2006, 01:07 PM
  5. [SOLVED] VBA to display image on a form - image is defined in Range Name
    By Tan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2006, 10:45 AM

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