Publisher: Creating a Linked Picture from an Embedded Picture (Part 2 of 2)
In the last entry, I showed you how to write a function that creates a separate .jpg file from a picture embedded in a publication. Now, let's finish the job by replacing the embedded picture with a picture linked to the new .jpg file.
Below is an example of a procedure that may call this function. It specifies the shape from which to create a linked picture, and the location to which to save the resulting picture file. It takes the file path returned from the function and uses it to replace the embedded picture with the newly-created linked picture.
Dim pubShape As Shape
Dim PubFileName As String
Dim PicFileName As String
'Select the embedded picture to create a linked picture from
Set pubShape = ActiveDocument.Pages(3).Shapes("Picture 5")
'Specify the file path to save picture
PubFileName = ActiveDocument.FullName
PicFileName = CreatePictureAsFile(pubShape, PubFileName)
'Replace embedded picture with linked picture
pubShape.PictureFormat.Replace pathname:=PicFileName, _