+ Reply to Thread
Results 1 to 12 of 12

Insert Image Macro

  1. #1
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Dartford
    MS-Off Ver
    Excel 2007
    Posts
    237

    Unhappy Insert Image Macro

    Can anyone help at all, I am a complete novice at Coding and I am having real problems.

    I want to be able to click a button on my Excel Spreadsheet that will take me to my JPeg Photo location and allow me to add a JPeg Photo.

    I have the below code but i does not recognise the JPeg File, so it work upto actually being able to select an image.

    Please Login or Register  to view this content.
    Can anyone tell me where I have gone wrong?

    Shazz

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Insert Image Macro

    Your code works for me.

    A picture of the selected jpeg file is inserted on to the active sheet.

    I notice you macro is called Image1_Click. Does this mean you actually have a image control you want to load the picture into? If so then

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Dartford
    MS-Off Ver
    Excel 2007
    Posts
    237

    Re: Insert Image Macro

    It just came up with that title.

    It does not work for me and I do not understand the other code you have stated, please speak to me like you would a child as I do not no what i am doing. I need instructions.

    Shazz

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Insert Image Macro

    If the title was automatic then it would strongly suggest that the control was not a button but rather an image control.

    As I said you code works. After locating a .jpeg file it inserts it on the active worksheet. Is this what you want to happen?

    If as I suspect you want the image control to load a picture then the code I posted would be that.

    If still confused post your workbook with explanation of what you expect to happen.

  5. #5
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Dartford
    MS-Off Ver
    Excel 2007
    Posts
    237

    Re: Insert Image Macro

    I am really sorry I have just noticed that this is to save an image and not insert the image.

    Can you tell me how to do a code for inserting an image from my computer into my excel spreadsheet.

    Shazz

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Insert Image Macro

    now I am totally confused

    All code so far in this post puts an image into a workbook, either on the worksheet or within an image control.

    I have just noticed that this is to save an image and not insert the image.
    What exactly did you just notice?
    What do you actually want to do?

  7. #7
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Dartford
    MS-Off Ver
    Excel 2007
    Posts
    237

    Re: Insert Image Macro

    Yes I do want it to insert the JPeg into the active sheet, It still does not work on mine, it will not find the JPEG Files.

    Dont worry I will keep looking on the internet for a solution.

    Shazz

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Insert Image Macro

    So are you saying the file browser dialog that opens can not locate any .jpeg files? If so I have to ask. Do you have any .jpeg files? perhaps they are actually .jpg

  9. #9
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Dartford
    MS-Off Ver
    Excel 2007
    Posts
    237

    Talking Re: Insert Image Macro

    Hiya,

    I feel so stupid, I worked that out just before your post, I thought they were the same thing, I told you I was a complete novice lol.

    They are JPG not JPEG...........

    Another question, Do you now have I would resize the uploaded photos, attached is my workbook and I would like the photo to be the same size as the merged Square.

    Shazz
    Attached Files Attached Files

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Insert Image Macro

    First in your workbook goto in design mode and position the right hand image control over the cells.

    The select the left hand image and right click. View code and paste the following code.

    Please Login or Register  to view this content.
    This will then update the right hand image with the selected image.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Dartford
    MS-Off Ver
    Excel 2007
    Posts
    237

    Re: Insert Image Macro

    Is there a way of doing it so that the Merged Cells with my Insert Picture Button contains the Inserted Image, so it kind of goes over the button, so If I remove the image the button appears again?

    Shazz

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Insert Image Macro

    use this code instead.

    Please Login or Register  to view this content.

+ 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