MACRO LIBRARY

Set the name of a note

Free public access. No account or subscription required.

Files

Set the name of a note

Code

'Demonstrates how to set the name of a note
    
'Written by Keith Rice
'CADSharp LLC
'www.cadsharp.com
    
'Preconditions: Drawing is open, note is selected
'Results: note text is changed; see also immediate window
    
Option Explicit
    
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDrawing As SldWorks.DrawingDoc
Dim swSelMgr As SldWorks.SelectionMgr
Dim swNote As SldWorks.Note
Dim swAnn As SldWorks.Annotation
    
Sub main()
    
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swNote = swSelMgr.GetSelectedObject6(1, 0)
Set swAnn = swNote.GetAnnotation
    
    Debug.Print swAnn.GetName
    swAnn.SetName "New note text"
    Debug.Print swAnn.GetName
    
End Sub