I have a VBA code, which inserts image into excel based on the cell value entered in coloumn A. My problem is that image is a link, and when I share the file with people out of network, they can't see the image. I researched, and I see that "Pictures.Insert" should be changed to "Shapes.AddPicture", but I do something wrong and get error.
Can you please help with this?
here is the code, I want to modify:
Private Sub Worksheet_Change(ByVal Target As Range)
If (Split(Target.Address, "$")(1) <> "A") Then Exit Sub
Dim c As Range
Dim myPath As String
myPath = "C:\Users\ED\Pictures\"
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)
Application.ScreenUpdating = True
Sub InsertPicture(thePath As String, theRange As Range)
.LockAspectRatio = msoTrue
.Width = theRange.Width
.Height = theRange.Height
.Left = theRange.Left
.Top = theRange.Top
.Placement = 1
.PrintObject = True