    'Export workpoint coordinates to Excel
	If (ThisApplication.ActiveDocumentType <> kPartDocumentObject And _
	    ThisApplication.ActiveDocumentType <> kAssemblyDocumentObject) Then
        MsgBox ("Open a part or assembly")
        Exit Sub
    End If
    
    Dim oPart As Document
    oPart = ThisApplication.ActiveDocument
    
	Dim dlmtr As String = ";" ' or vbTab
    Dim expFile As System.IO.StreamWriter
    expFile = System.IO.File.CreateText(ThisDoc.PathAndFileName(False) & "-WP.csv")
	expFile.WriteLine("Name" & dlmtr & "X" & dlmtr & "Y" & dlmtr & "Z")
    
	Dim oWP As WorkPoint
    For Each oWP In oPart.ComponentDefinition.WorkPoints
	 matches = System.Text.RegularExpressions.Regex.Matches(oWP.Name, "Prac.*") ' or Work.*
	 If matches.count>0 Then ' just manual workpoints
      expFile.WriteLine( oWP.Name & dlmtr & oWP.Point.X & dlmtr & oWP.Point.Y & dlmtr & oWP.Point.Z)
	 End If
    Next
    
    expFile.Close
	ThisDoc.Launch(ThisDoc.PathAndFileName(False) & "-WP.csv")
    'MsgBox ("Part workpoints exported to " & ThisDoc.PathAndFileName(False) & "-WP.csv" & _
	'vbCrLf & "(you can load this '" & dlmtr & "'-delimited file into Excel)")
