Hallo
ich will eine Stückliste nach Excel exportieren. Ich habe auch schon einen Code in der Programierungshife gefunden dieser funktioniert soweit auch.
Ist es möglich das für den Excelexport eine Vorlagedatei verwendet wird.
Verwendeter Code:
Public Sub BOMExport()
' Set a reference to the assembly document.
' This assumes an assembly document is active.
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
' Set a reference to the BOM
Dim oBOM As BOM
Set oBOM = oDoc.ComponentDefinition.BOM
' Set the structured view to 'all levels'
oBOM.StructuredViewFirstLevelOnly = False
' Make sure that the structured view is enabled.
oBOM.StructuredViewEnabled = True
' Set a reference to the "Structured" BOMView
Dim oStructuredBOMView As BOMView
Set oStructuredBOMView = oBOM.BOMViews.Item("Structured")
' Export the BOM view to an Excel file
oStructuredBOMView.Export "C:\temp\BOM-StructuredAllLevels.xls", kMicrosoftExcelFormat
' Make sure that the parts only view is enabled.
oBOM.PartsOnlyViewEnabled = True
' Set a reference to the "Parts Only" BOMView
Dim oPartsOnlyBOMView As BOMView
Set oPartsOnlyBOMView = oBOM.BOMViews.Item("Parts Only")
' Export the BOM view to an Excel file
oPartsOnlyBOMView.Export "C:\temp\BOM-PartsOnly.xls", kMicrosoftExcelFormat
End Sub
Nun wollte ich für kMicrosoftExcelFormat angehängte Optionen verwenden.
Leider bin ich in Sachen VBA noch ein Anfänger und hab schon mehrere Möglichkeiten ausprobiert jedoch führte keine zu dem gewünschten Erfolg.
Gibt es überhaupt die Möglichkeit eine Vorlagedatei zu verwenden.
Mfg
Roland
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP