mich interessiert im Augenblick welche Verknüpfungen ich in der einen oder anderen PowerPoint Präsentation habe.
Diesbezüglich habe ich auch ein VBA-Makro geschrieben:
Code: Alles auswählen
Private Sub Link_Look()
Dim Praes As Presentation
Dim Blatt As Slide
Dim Bild As Shape
Set Praes = ActivePresentation
For Each Blatt In Praes.Slides
For Each Bild In Blatt.Shapes
If (Bild.Type = msoLinkedOLEObject) Then
Debug.Print Bild.LinkFormat.SourceFullName
End If
Next
Next
End SubDa ich aber mehrere Dateien habe wollte ich über PB ein Programm schreiben in dem ich die PowerPointDatei aufrufen und
das Makro von PB aus über die Datei laufen lasse, um die Informationen mir anzuzeigen.
Ich habe mir gedacht ich versuche es einmal mit COMate aber irgendwie komme ich nicht zurande.
Vielleicht kann mir ja jemand von euch den entscheidenen Gedankenblitz zukommen lassen.
Ich bin bis dato auf dieses Ergebnis gekommen, wobei ich mir nicht sicher bin ob es allen Tests standhalten würde.
Code: Alles auswählen
XIncludeFile "comateplus.pbi"
EnableExplicit
#pptFile = "test.ppt"
Global NewList gLinks.s()
Procedure ppLinks(vFile.s)
Protected pApp.COMateObject ; Application
Protected pPres.COMateObject ; Presentation
Protected pSlides.COMateEnumObject ; Slides
Protected pShapes.COMateEnumObject ; Shapes
Protected pSld.COMateObject ; Slide Object
Protected pShp.COMateObject ; Shape Object
Protected pValue.s
pApp = COMate_CreateObject("PowerPoint.Application")
If pApp
pPres = pApp\GetObjectProperty("Presentations\Open('" + vFile + "', #Optional, #Optional, #False)")
If pPres
pSlides = pPres\CreateEnumeration("Slides")
If pSlides
pSld = pSlides\GetNextObject()
While pSld
pShapes = pSld\CreateEnumeration("Shapes")
If pShapes
pShp = pShapes\GetNextObject()
While pShp
If pShp\GetIntegerProperty("Type") ;=?: msoLinkedOLEObject
pValue = pShp\GetStringProperty("LinkFormat\SourceFullName")
If pValue
AddElement(gLinks())
gLinks() = pValue
EndIf
EndIf
pShp\Release()
pShp = pShapes\GetNextObject()
Wend
pShapes\Release()
EndIf
pSld\Release()
pSld = pSlides\GetNextObject()
Wend
pSlides\Release()
EndIf
pPres\Invoke("Close")
pPres\Release()
Else
Debug "!pPres"
Debug COMate_GetLastErrorDescription()
EndIf
pApp\Invoke("Quit")
pApp\Release()
Else
Debug "!pApp"
Debug COMate_GetLastErrorDescription()
EndIf
EndProcedure
ppLinks(#pptFile)
ForEach gLinks(): Debug gLinks(): Next
End