Dies hier sollte helfen
*************
Option Explicit
Public Sub AP_to_excel()
Dim oPoint As Point
Dim oWP As WorkPoint
Dim od As PartDocument
Set od = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition
Set oCompDef = odComponentDefinition
Dim iRow As Long
Dim i As Long
Dim XL As Object
Dim xlWB As Object
Dim xlWS As Object
Set XL = CreateObject("Excel.Application")
Set xlWB = XL.Workbooks.Add
Set xlWS = xlWB.ActiveSheet
XL.Application.Visible = True
iRow = 1
xlWS.Cells(iRow, 1).Value = "NAME"
xlWS.Cells(iRow, 2).Value = "X"
xlWS.Cells(iRow, 3).Value = "Y"
xlWS.Cells(iRow, 4).Value = "Z"
For i = 1 To od.ComponentDefinition.WorkPoints.Count
Set oWP = od.ComponentDefinition.WorkPoints.Item(i)
Debug.Print oCompDef.WorkPoints.Item(i).Name
Debug.Print oCompDef.WorkPoints.Item(i).Point.X
Debug.Print oCompDef.WorkPoints.Item(i).Point.Y
Debug.Print oCompDef.WorkPoints.Item(i).Point.Z
xlWS.Cells((i + 1), 1).Value = oCompDef.WorkPoints.Item(i).Name
xlWS.Cells((i + 1), 2).Value = oCompDef.WorkPoints.Item(i).Point.X
xlWS.Cells((i + 1), 3).Value = oCompDef.WorkPoints.Item(i).Point.Y
xlWS.Cells((i + 1), 4).Value = oCompDef.WorkPoints.Item(i).Point.Z
Next
Passt Größe der Zeilen und Spalten an die Werte an
XL.Cells.Select
XL.Cells.EntireColumn.AutoFit
xlWS.Range("A1").Select
End Sub
------------------
[img][/img]
"Das Motto des Tages"
Wir hatten nie 'ne Schulung in Inventor
Wir hatten nie 'ne Schulung in Methodik
Wir haben keinen Wartungsvertrag
Wir haben keinen Admin
Wir haben trotzdem Spaß!
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP