Home > Community > Automation and VBA > 2D_Diagramm mit VBA in Excel Tabelle einfügen > Reply To: 2D_Diagramm mit VBA in Excel Tabelle einfügen

#35460
Adrian GiurcaAdrian Giurca
Moderator

Hi Mario,

the following approach can be adopted:

Option Explicit

Public Sub ParseFlexProDatabase()
    ProcessFolder ThisDatabase.RootFolder
End Sub

Private Sub ProcessFolder(ByRef oFld As Folder)
    ' versteckte Ordner (wie den Vorlagenordner) überspringen
    ' skip hidden folders (like the template folder)
    
    Dim sExportFolderPath As String
    sExportFolderPath = "D:\Export\"
    
    If Not oFld.Hidden Then
        Dim oObjs As FpObjects
        Dim oObj As FpObject
        
        Set oObjs = oFld.Objects()
        
        For Each oObj In oObjs
            If (oObj.ObjectType = fpObjectType2DDiagram) Or _
               (oObj.ObjectType = fpObjectTypeColumnTable) Or _
               (oObj.ObjectType = fpObjectTypeCellTable) Then
                    oObj.Export fpExportFormatJPEG, sExportFolderPath & Replace(oObj.FullName, "\", "_") & ".jpg"
            End If
        Next oObj
        
        ' Unterordner rekursiv bearbeiten
        ' Edit subfolders recursively
        Set oObjs = oFld.Objects(fpObjectTypeFolder)
        Dim oSubFld As Folder
        For Each oSubFld In oObjs
            ProcessFolder oSubFld
        Next
    End If
End Sub

BR
Adrian