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
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