Forum Discussion

michalduszak's avatar
michalduszak
Copper Contributor
Jun 08, 2022
Solved

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...
  • HansVogelaar's avatar
    Jun 08, 2022

    michalduszak 

    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

Resources