Private Sub SurfPoint()
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim SelMgr As SldWorks.SelectionMgr
Dim NumSelects As Long
Dim SelectedObj As Object
Dim PickPoint As Variant
Dim StickPoint As Variant
Dim sMsg As String
Dim UnitFactor As Double
UnitFactor = 1000 'Get from m to mm
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set SelMgr = swDoc.SelectionManager
NumSelects = SelMgr.GetSelectedObjectCount
If NumSelects = 0 Then
MsgBox "Pick a surface and run macro again"
Exit Sub
End If
Set SelectedObj = SelMgr.GetSelectedObject(NumSelects)
PickPoint = SelMgr.GetSelectionPoint2(NumSelects, -1)
If SelMgr.GetSelectedObjectType3(NumSelects, -1) = 2 Then
sMsg = "X: " & Str(PickPoint(0) * UnitFactor) & vbCrLf & _
"Y: " & Str(PickPoint(1) * UnitFactor) & vbCrLf & _
"Z: " & Str(PickPoint(2) * UnitFactor)
MsgBox sMsg
Else
MsgBox "You must select a surface"
End If
Set SelectedObj = Nothing
Set SelMgr = Nothing
Set swDoc = Nothing
Set swApp = Nothing
End Sub