Here is the whole macro:
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long
Dim Annotation As Object
Dim Gtol As Object
Dim DatumTag As Object
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Public Pfx As String
Dim myNote As SldWorks.Note
Dim SelMgr As SldWorks.SelectionMgr
Dim mySketchPoint As SldWorks.SketchPoint
Const FMAT As String = "0,00"
Const SF As Double = 1000
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager
Pfx = InputBox("Enter point number")
Pfx = "POINT " & Pfx & vbCrLf
If SelMgr.GetSelectedObjectType3(1, -1) <> 25 Then
MsgBox "Select a 3D sketch point and run macro again"
Exit Sub
End If
Set mySketchPoint = SelMgr.GetSelectedObject6(1, -1)
Set myNote = Part.InsertNote(Pfx)
If Not myNote Is Nothing Then
myNote.Angle = 0
boolstatus = myNote.SetText(Pfx & "X=" & Format(mySketchPoint.X * SF, FMAT) & _
vbCrLf & "Y=" & Format(mySketchPoint.Y * SF, FMAT) & _
vbCrLf & "Z=" & Format(mySketchPoint.Z * SF, FMAT))
boolstatus = myNote.SetBalloon(0, 0)
Set Annotation = myNote.GetAnnotation()
If Not Annotation Is Nothing Then
longstatus = Annotation.SetLeader2(True, 0, True, True, False, False)
End If
End If
Part.ClearSelection
Part.WindowRedraw
End Sub