Forum Discussion
michalduszak
Jun 08, 2022Copper Contributor
Linked pictures to embedded
Hello, I have a macro to generate a spreadsheet with many worksheets with images. Unfortunately they have linked images. I need to send this file, but person who received it cannot display images...
- Jun 08, 2022
Try this:
Sub ConvertLinkedShapes() Dim w As Worksheet Dim s As Shape Dim t As Single Dim l As Single Application.ScreenUpdating = False For Each w In Worksheets For Each s In w.Shapes If s.Type = msoLinkedPicture Then t = s.Top l = s.Left s.Cut w.Pictures.Paste With w.Pictures(w.Pictures.Count) .Top = t .Left = l End With End If Next s Next w Application.ScreenUpdating = True End Sub
HansVogelaar
Jun 08, 2022MVP
Try this:
Sub ConvertLinkedShapes()
Dim w As Worksheet
Dim s As Shape
Dim t As Single
Dim l As Single
Application.ScreenUpdating = False
For Each w In Worksheets
For Each s In w.Shapes
If s.Type = msoLinkedPicture Then
t = s.Top
l = s.Left
s.Cut
w.Pictures.Paste
With w.Pictures(w.Pictures.Count)
.Top = t
.Left = l
End With
End If
Next s
Next w
Application.ScreenUpdating = True
End Sub- michalduszakJun 08, 2022Copper ContributorIt works! Thank you a lot!