How to embed a linked picture in Excel
Posted: Mon Aug 26, 2019 1:25 am
After moving your Excel file to a different location, if you find your images were linked and not embedded, here is a solution to embed those.
First move the file back the location where images work. Open the Excel file and you should be able to see the images ok.
Now open VBA and put following code. It will embed the picture and delete the linked image.
First move the file back the location where images work. Open the Excel file and you should be able to see the images ok.
Now open VBA and put following code. It will embed the picture and delete the linked image.
Code: Select all
Sub UnlinkImage()
For Each Shape In ActiveSheet.Shapes
If Shape.TopLeftCell.Column = 5 Then
Shape.Copy
Range("E" & Shape.TopLeftCell.Row).Select
ActiveSheet.PasteSpecial Format:="Picture (PNG)", Link:=False, DisplayAsIcon:=False
Set c = Cells(Shape.TopLeftCell.Row, "E")
Selection.Left = c.Left + c.Width / 2 - Selection.Width / 2
Selection.Top = c.Top + c.Height / 2 - Selection.Height / 2
Shape.Delete ' Delete original image
End If
Next Shape
End Sub