Anchor a Note Example (VBA)
This example shows how to anchor a note.
'----------------------------------------------------------------------------
' Preconditions: Open:
' install_dir\samples\tutorial\advdrawings\foodprocessor.slddrw
'
' Postconditions: The Drawing View1 note is locked in position.
'
' NOTE: Because the model is used elsewhere,
' do not save changes when closing it.
' ---------------------------------------------------------------------------
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim myNote As SldWorks.Note
Dim myAnnotation As SldWorks.Annotation
Dim boolstatus As Boolean
Option Explicit
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set myNote = Part.InsertNote("Drawing
View1")
If Not myNote Is Nothing Then
myNote.LockPosition = True
Set myAnnotation = myNote.GetAnnotation()
If Not myAnnotation Is Nothing Then
boolstatus =
myAnnotation.SetPosition(0.2, 0.269, 0)
End If
End If
Part.ClearSelection2 True
Part.WindowRedraw
End Sub