Changing note text style - vba

I' trying to change a note text style using a vba macro.

I created 2 styles, and I recorded myself switching between the 2, and I got something like this:

Dim swApp As Object

Dim Part As Object

Dim boolstatus As Boolean

Dim longstatus As Long, longwarnings As Long

Sub main()

Set swApp = _

Application.SldWorks

Set Part = swApp.ActiveDoc

Dim myNote As Object

boolstatus = Part.Extension.SelectByID2("Objet de détail184@Feuille1", "NOTE", 0.111882989473684, 0.139244136842105, 0, False, 0, Nothing, 0)

Set myNote = Part.SelectionManager.GetSelectedObject5(1)

Dim myAnno As Object

If Not myNote Is Nothing Then

   Set myAnno = myNote.GetAnnotation()

   myAnno.SetStyleName "NoteSTD"

End If

End Sub

---

Now when I run the macro, it select my note.

If lauch it again, then my annotation change to the good style, but my note also change for "4."

Any thought?

SolidworksApi macros
Answers 0