Das hier habe ich auch noch gefunden. Das Macro erstellt mir zwar eine Excel, aber da bringt er mir den Fehler "Run-time error '13': Type mismatch".
Wenn ich dann auf debug gehe, markiert er mir die Zeile 56 ("Point.GetCoordinates (coords)"). Ich hab aber keine Ahnung was da der Fehler ist.
Dim objGEXCELapp As Object
Dim objGEXCELwkBks As Object
Dim objGEXCELwkBk As Object
Dim objGEXCELwkShs As Object
Dim objGEXCELSh As Object
Dim fs, f, f1, fc, s
Dim coords(2) As Integer
Dim PartDocument1
Sub CATMain()
CATIA.ActiveDocument.Selection.Search "CATGmoSearch.Point,all"
StartEXCEL
ExportPoint
'objGEXCELSh.Application.ActiveWorkbook.SaveAs (ExcelFolder & Left(CATIA.ActiveDocument.Name,Len(CATIA.ActiveDocument.Name)-8) & ".xls")
'objGEXCELSh.Application.ActiveWorkbook.Close
End Sub
'******************************************************************************
Sub StartEXCEL()
'******************************************************************************
Err.Clear
On Error Resume Next
Set objGEXCELapp = GetObject(, "EXCEL.Application")
If Err.Number <> 0 Then
Err.Clear
Set objGEXCELapp = CreateObject("EXCEL.Application")
End If
objGEXCELapp.Application.Visible = True
Set objGEXCELwkBks = objGEXCELapp.Application.WorkBooks
Set objGEXCELwkBk = objGEXCELwkBks.Add
Set objGEXCELwkShs = objGEXCELwkBk.Worksheets(1)
Set objGEXCELSh = objGEXCELwkBk.Sheets(1)
objGEXCELSh.Cells(1, "A") = "Name"
objGEXCELSh.Cells(1, "B") = "X"
objGEXCELSh.Cells(1, "C") = "Y"
objGEXCELSh.Cells(1, "D") = "Z"
End Sub
'******************************************************************************
Sub ExportPoint()
'******************************************************************************
For i = 1 To CATIA.ActiveDocument.Selection.Count
Set Selection = CATIA.ActiveDocument.Selection
Set Element = Selection.Item(i)
Set Point = Element.Value
'Write PointData to Excel Sheet
Point.GetCoordinates (coords)
objGEXCELSh.Cells(i + 1, "A") = Point.Name
objGEXCELSh.Cells(i + 1, "B") = coords(0)
objGEXCELSh.Cells(i + 1, "C") = coords(1)
objGEXCELSh.Cells(i + 1, "D") = coords(2)
Next
End Sub
------------------
Beste Grüße
Tim
___________
Zu dumm gibt es nicht, nur zu faul zum Fragen :-)
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP