What am I trying to do?
- Several "Publisher Documents" contain chart images that are linked to a single Excel file
- The Excel fle is updated and VBA (in Excel) is then used to update the Publisher Documents
- After making amendments to the linked shapes I want to break all the links in the Publisher documents
- Which sounds simple enough ...
This POWERPOINT example from Microsoft shows how to update and then break the links to any shapes that are linked to OLE objects on slide one in the active presentation.
Public Sub BreakLink_Example()
Dim pptShape As Shape
For Each pptShape In ActivePresentation.Slides(1).Shapes
With pptShape
If .Type = msoLinkedOLEObject Then
.LinkFormat.Update
.LinkFormat.BreakLink
End If
End With
Next pptShape
End Sub
Using the same logic and structure, this should work with Publisher, but it does not
Dim shp As Object, p As Integer, s As Integer
For p = 1 To pDoc.Pages.Count
For s = 1 To pDoc.Pages(p).Shapes.Count
Set shp = pDoc.Pages(p).Shapes(s)
If shp.Type = pbLinkedOLEObject Then
shp.LinkFormat.Update THIS WORKS FINE
shp.LinkFormat.BreakLink THE CODE BREAKS HERE
End If
Next s
Next p
.LinkFormat.BreakLink simply does not appear to be available in Publisher
(it is odd that .LinkFormat.Update does what you would expect, but that .BreakLink is not available)
Is anyone aware of VBA code that will simply break ALL links in a Publisher file
- This is the final piece in the jigsaw to solve this thread and the code I am trying to modify is in post#12
thanks
Bookmarks