Files
Traverse notes and change their text
Code
'Demonstrates how to cycle through all notes and change their values
'Written by Keith Rice
'CADSharp LLC
'www.cadsharp.com
' Preconditions: Drawing document is open.
' Postconditions: All notes in the drawing template are selected.
Option Explicit
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Dim swNote As SldWorks.Note
Dim swAnn As SldWorks.Annotation
Dim bRet As Boolean
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swDraw = swModel
Set swView = swDraw.GetFirstView ' This is the drawing template
Set swNote = swView.GetFirstNote
swModel.ClearSelection2 (True)
Do While Not swNote Is Nothing
Set swAnn = swNote.GetAnnotation
swAnn.Select2 True, 0 'selects it
swNote.SetText "Let's try this out."
Set swNote = swNote.GetNext
Loop
End Sub