Results 1 to 5 of 5

Thread: Input Photo Macro

  1. #1
    New Member
    Join Date
    Jun 2019
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Input Photo Macro

    Hello!

    I am looking to create a macro that will input a photo intoa spreadsheet in a certain location. Ifound the below from a different user online:

    Sub GetPic1()
    Dim fNameAndPath As Variant
    Dim img As Picture
    fNameAndPath =Application.GetOpenFilename(Title:="Select Picture To Be Imported")
    If fNameAndPath = False Then Exit Sub
    Set img =ActiveSheet.Pictures.Insert(fNameAndPath)
    With img
    'Resize Pictureto fit in the range....
    .Left =ActiveSheet.Range("D12").Left
    .Top =ActiveSheet.Range("D12").Top
    .Width =ActiveSheet.Range("D12:I12").Width
    .Height =ActiveSheet.Range("D12:D27").Height
    .Placement = 1
    .PrintObject =True
    End With
    End Sub

    The issue I am having is when someone uses it on a differentcomputer and emails me the excel file, I am not able to view the photo in thespreadsheet. It says “The linked imagecannot be displayed.The file may havebeen moved, renamed, or deleted.Verifythat the link points to the correct file and location.”

    I do not know much about VBA or writing macros in excel, butit looks like it is trying to access the path to the file on the computer inwhich the photo is located? Is there anyway to change this macro so that it doesn’t link to the photo’s path on theuser’s computer and just pastes the image?I want the image to be viewable by someone who is accessing thespreadsheet on a different computer.

    Thank you!

    ~ Bosshog

  2. #2
    Board Regular Logit's Avatar
    Join Date
    Aug 2016
    Location
    United States
    Posts
    2,640
    Post Thanks / Like
    Mentioned
    34 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Input Photo Macro

    Is the workbook saved before being sent in an email ?

  3. #3
    New Member
    Join Date
    Jun 2019
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Input Photo Macro

    Quote Originally Posted by Logit View Post
    Is the workbook saved before being sent in an email ?
    Yep.

  4. #4
    New Member
    Join Date
    Jul 2019
    Location
    Florida
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Input Photo Macro

    Check out this link. It describes your exact concern.

    https://www.mrexcel.com/excel-tips/v...t-picture-bug/

  5. #5
    New Member
    Join Date
    Jun 2019
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Input Photo Macro

    Quote Originally Posted by amyHHD View Post
    Check out this link. It describes your exact concern.

    https://www.mrexcel.com/excel-tips/v...t-picture-bug/
    Thank you so much! This is exactly what I was looking for and it works perfectly!

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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