Hallo Forum,
ich möchte ein Makro schreiben, welches aus der Baugruppe die Stückliste strukturiert in eine EXCEL-Datei Ausliest. Mit dem Forum und der Hilfe bin ich auch schon weit gekommen. Aber jetzt habe ich folgendes Problem:
Die Reihenfolge der Rausgeschriebenen Zeilen Ist nicht geordnet wie die Stüli-Ansicht strukturiert sondern wie die Bauteilreihenfolge im Browser. Muss ich die Daten erst sortieren oder hab ich was übersehen. Bitte helft mir:
Dim oBOM As BOM
Set oBOM = ThisApplication.ActiveDocument.ComponentDefinition.BOM
Dim oRow As BOMRow
Dim oBOMView As BOMView
Set oBOMView = oBOM.BOMViews.Item("Strukturiert")
Dim Zeile As Long
Zeile = 3
Dim Position As Long
Position = 0
Dim letzte_Position As Long
letzte_Position = 0
Dim i As Long
For i = 1 To oBOMView.BOMRows.Count
' Get the current row.
Set oRow = oBOMView.BOMRows.Item(i)
Dim oCompDef As ComponentDefinition
Set oCompDef = oRow.ComponentDefinitions.Item(1)
Dim oPropSet As PropertySet
Set oPropSet = oCompDef.Document.PropertySets.Item("Design Tracking Properties")
'Zellen beschreiben
letzte_Position = Postion
Postion = oRow.ItemNumber
'Position
xlWS.Application.Cells(Zeile, 2).Value = oRow.ItemNumber
'Anzahl
xlWS.Application.Cells(Zeile, 3).Value = oRow.ItemQuantity
'Benennung
xlWS.Application.Cells(Zeile, 4).Value = oPropSet.Item("Description").Value
'Bauteilnummer
xlWS.Application.Cells(Zeile, 5).Value = oPropSet.Item("Part Number").Value
'Kürzel
xlWS.Application.Cells(Zeile, 6).Value = oPropSet.Item("Catalog Web Link ").Value
'Werkstoff
xlWS.Application.Cells(Zeile, 7).Value = oPropSet.Item("Material").Value
'Halbzeug
xlWS.Application.Cells(Zeile, 8).Value = oPropSet.Item("Revision Number ").Value
'Zulieferer
xlWS.Application.Cells(Zeile, 9).Value = oPropSet.Item("Vendor").Value
Zeile = Zeile + 1
Next
Vielen Dank im Voraus.
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP