Home > Community > Automation and VBA > Automating JPEG export of charts > Antwort auf: Automating JPEG export of charts

#9382
Bernhard KantzBernhard Kantz
Teilnehmer

The document consists of a collection of pages, each containing a collection of shapes. Some of them like tables and diagrams have DocObjects associated with. The following sample enumerates the diagrams of a document and displays their name.


Sub DocuTest()
    Dim oDoc As Document
    Set oDoc = ThisDatabase.RootFolder("Dokument", fpObjectTypeDocument)
    
    Dim oShapes As Shapes
    For Each oShapes In oDoc.Pages
        Dim oShape As Shape
        For Each oShape In oShapes
            If Not oShape.DocObject Is Nothing Then
                If oShape.DocObject.ObjectType = fpObjectType2DDiagram _
                Or oShape.DocObject.ObjectType = fpObjectType3DDiagram Then
                    MsgBox oShape.DocObject.Name
                End If
            End If
        Next
    Next
End Sub