I have the following code for inserting images in Excel, but when I sent the file to the users out of the network, they are not able to see the pictures. Is there any way to modify the code, so as it will be not link, but embedded image? Here is the code:
Private Sub Worksheet_Change(ByVal Target As Range)
If (Target.Count > 1) Or (Split(Target.Address, "$")(1) <> "A") Then Exit Sub
Dim c As Range
Dim myPath As String
myPath = "P:\"
Application.ScreenUpdating = False
For Each c In Target.Cells
If Not Dir(myPath & "*" & c.Text & "*") = "" Then
InsertPicture myPath & Dir(myPath & "*" & c.Text & "*"), c.Offset(0, 1)
End If
Next c
Application.ScreenUpdating = True
End Sub
Sub InsertPicture(thePath As String, theRange As Range)
With ThisWorkbook.ActiveSheet.Pictures.Insert(thePath)
With .ShapeRange
.LockAspectRatio = msoTrue
.Width = theRange.Width
.Height = theRange.Height
End With
.Left = theRange.Left
.Top = theRange.Top
.Placement = 1
.PrintObject = True
End With
End Sub
Thank you!