PDA

View Full Version : Solved: Locate 'External Content'



Paul_Hossler
08-07-2009, 04:34 PM
PP2007, Vista -- Some how I had 'External Content' in a presentation picture. I assume it was a link to a picture on a slide.

It took FOREVER by trial and error to track down what I assume was a link, and paste the picture instead of the link.

Does PP have any facility or option to list the external content in a presentation, including information such as the location and the source?

Is there a VBA solution to at least loop through the slide and the contents to list information about External Content

Paul

John Wilson
08-07-2009, 10:31 PM
Paul
Just checking I understand the question!

Are you asking how to see the source of a linked picture?

Paul_Hossler
08-08-2009, 08:07 AM
John -- I was looking to see if there's a non-VBA or a VBA way to locate the external content within a presentation

In the attached is the slide (out of the original 100+) in the presentation that seems to reference something external

It was a very tedious trial-and-error process to manually check the presentation.

I thought there might be a "Show External" button, or

For each slide in activepresentation
for each object in slide
if <some test> then
Msgbox Object.name on slide number, etc.


I even tried renaming the PPTX as .ZIP and poked around inside, but could not see anything I recognized

Thanks

Paul

John Wilson
08-08-2009, 09:02 AM
Looks like this has been copy pasted from the web and some html code has been included. Have a look at the alt text
Right click > Size & Position > Alt Text

You should be able to detect "odd" alt text with vba and cut / paste special as jpg. You will need to detect and reset the left and top and maybe the zorder. Animation if any will be killed.

Paul_Hossler
08-08-2009, 09:55 AM
:bow:

Again, you're the Master

Turns out, that picture was from a Teacher's CD for a course my wife teaches (such use is allowed by the publisher)

You got me pointed in the right direction, and this is the VBA that I came up with. Not very polished, but enough to allow me to track such things down, and manually "de-link' them


Option Explicit
Sub Locate_External_Content()
Dim oSlide As Slide, oShape As Shape

For Each oSlide In ActivePresentation.Slides
For Each oShape In oSlide.Shapes
Select Case oShape.Type
Case msoLinkedOLEObject, msoLinkedPicture
Call MsgBox("Linked Item found" & vbCrLf & vbCrLf & _
"Slide number " & oSlide.SlideIndex & vbCrLf & vbCrLf & _
"Shape named " & oShape.Name & vbCrLf & vbCrLf & _
"Source from " & oShape.LinkFormat.SourceFullName, _
vbInformation + vbOKOnly, "Locate External Content")
End Select
Next
Next
End Sub


Paul

John Wilson
08-10-2009, 08:16 AM
Thats good! One thing, I was caught out recently with similar code when the client had pasted the linked pic into a placeholder. This didn't show up as a linked picture!

I used

Select Case oshape.Type
Case Is = msoPlaceholder
If oshape.PlaceholderFormat.ContainedType = msoLinkedPicture Then

Paul_Hossler
08-10-2009, 02:57 PM
Thanks - that would have been a HARD one to track down.

Final (OK, the latest :) ) version



Option Explicit
Private Const cModule As String = "Locate External Content (ver 1.01, 8/10/2009)"
Sub Locate_External_Content()
Dim oSlide As Slide, oShape As Shape
Dim iNumOfLinks As Long

iNumOfLinks = 0
For Each oSlide In ActivePresentation.Slides
For Each oShape In oSlide.Shapes
With oShape
Select Case .Type
Case msoLinkedOLEObject, msoLinkedPicture
iNumOfLinks = iNumOfLinks + 1
Call MsgBox("Linked Item found" & vbCrLf & vbCrLf & _
"Slide number " & oSlide.SlideIndex & vbCrLf & vbCrLf & _
"Shape named " & .Name & vbCrLf & vbCrLf & _
"Source from " & .LinkFormat.SourceFullName, _
vbInformation + vbOKOnly, cModule)
Case msoPlaceholder
Select Case .PlaceholderFormat.ContainedType
Case msoLinkedOLEObject, msoLinkedPicture
iNumOfLinks = iNumOfLinks + 1
Call MsgBox("Linked Item in Place Holder found" & vbCrLf & vbCrLf & _
"Slide number " & oSlide.SlideIndex & vbCrLf & vbCrLf & _
"Shape named " & .Name & vbCrLf & vbCrLf & _
"Source from " & .LinkFormat.SourceFullName, _
vbInformation + vbOKOnly, cModule)
End Select
End Select
End With
Next
Next

Select Case iNumOfLinks
Case 0
Call MsgBox("There were no linked objects found", vbInformation + vbOKOnly, cModule)
Case 1
Call MsgBox("There was only a single linked objects found", vbInformation + vbOKOnly, cModule)
Case Else
Call MsgBox("There were " & iNumOfLinks & " linked objects found", vbInformation + vbOKOnly, cModule)
End Select

End Sub



Paul

DeltaTee
05-07-2010, 06:50 AM
Thanks for writing this bit of code. It was extremely helpful and worked just as advertised. :-)