I'm using this macro to add images to an excel file in column A based on the value in column B. The macro is working as intended. However, when I email the file, the image turns into an error message saying "the linked image cannot be displayed. The file may have been removed." Does anyone know how to remove this link?
Sub Picture()
Dim picname As String
Dim pasteAt As Integer
Dim lThisRow As Long
lThisRow = 2
Do While (Cells(lThisRow, 2) <> "")
pasteAt = lThisRow
Cells(pasteAt, 1).Select 'This is where picture will be inserted
picname = Cells(lThisRow, 2) 'This is the picture name
present = Dir("C:\Users\Admin\Downloads\PICTURES\" & picname & ".jpg")
If present <> "" Then
ActiveSheet.Pictures.Insert("C:\Users\Admin\Downloads\PICTURES\" & picname & ".jpg").Select 'Path to where pictures are stored
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This resizes the picture
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
With Selection
.Left = Cells(pasteAt, 1).Left
.Top = Cells(pasteAt, 1).Top
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Height = 90#
.ShapeRange.Width = 60#
.ShapeRange.Rotation = 0#
End With
Else
Cells(pasteAt, 1) = "No Picture Found"
End If
lThisRow = lThisRow + 1
Loop
Range("A1").Select
Application.ScreenUpdating = False
Exit Sub
ErrNoPhoto:
MsgBox "Unable to Find Photo" 'Shows message box if picture not found
Exit Sub
Range("B20").Select
End Sub