Ciao
@IronCad
ho rivisto la tua macro, ho trovato un pò di errori, il principale era che i metodi che usavi per richiamare i fogli fanno parte del documento tavola (drawingdoc) mentre tu li richiamavi nel documento generico (object), infatti ti consiglio quando scrivi una macro di sovrascrivere i due oggetti principali in questo modo, così ti si attiva anche il menu dei metodi quanto premi il punto:
Dim swApp As Object 'Diventa
Dim swApp As SldWorks.SldWorks
'Per la tavola
Dim swDraw As Object 'Diventa
Dim swDraw As SldWorks.DrawingDoc
'Per la parte
Dim swPart As Object 'Diventa
Dim swPart As SldWorks.Partdoc
'Per l'assieme
Dim swAsm As Object 'Diventa
Dim swAsm As SldWorks.AssemblyDoc
Ad ogni modo ho riscritto tutto e ti ho inserito i commenti così capisci cosa sta facendo la macro nelle varie fasi.
Dim swApp As SldWorks.SldWorks
Dim swDraw As SldWorks.DrawingDoc
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim sheetCount As Long, i As Long
Dim swSheet As SldWorks.Sheet
Sub main()
Set swApp = Application.SldWorks
Set swDraw = swApp.ActiveDoc
'Ricavo il foglio attivo in questo momento
Set swSheet = swDraw.GetCurrentSheet
vSheetNameArr = swDraw.GetSheetNames
'Ricavo il nome del foglio attivo in questo momento
'mi serve alla fine per riportare dopo il ciclo di inserimento delle note
'attivo il foglio di partenza
Dim Nsheet As String
Nsheet = swSheet.GetName
'Ciclo i fogli
For Each vSheetName In vSheetNameArr
bRet = swDraw.ActivateSheet(vSheetName): Debug.Assert bRet
Dim myNote As Object
Dim myAnnotation As Object
Dim myTextFormat As Object
'Inserisco la nota
Set myNote = swDraw.InsertNote("<FONT size=72PTS style=B>BOZZA")
'Ne definisco le caratteristiche, posizione, colore ecc
If Not myNote Is Nothing Then
myNote.LockPosition = False
myNote.Angle = 0
boolstatus = myNote.SetBalloon(0, 0)
Set myAnnotation = myNote.GetAnnotation()
If Not myAnnotation Is Nothing Then
longstatus = myAnnotation.SetLeader3(swLeaderStyle_e.swNO_LEADER, 0, True, False, False, False)
boolstatus = myAnnotation.SetPosition(0.115, 0.07, 0)
Set myTextFormat = swDraw.GetUserPreferenceTextFormat(0)
myTextFormat.Italic = False
myTextFormat.Underline = False
myTextFormat.Strikeout = False
myTextFormat.Bold = True
myTextFormat.Escapement = 0
myTextFormat.LineSpacing = 0.001
myTextFormat.CharHeightInPts = True
myTextFormat.TypeFaceName = "Century Gothic"
myTextFormat.WidthFactor = 1
myTextFormat.ObliqueAngle = 0
myTextFormat.LineLength = 0
myTextFormat.Vertical = False
myTextFormat.BackWards = False
myTextFormat.UpsideDown = False
myTextFormat.CharSpacingFactor = 1
'Applico le caratteristiche alla nota
boolstatus = myAnnotation.SetTextFormat(0, False, myTextFormat)
'Deseleziono qualsiasi selezione attiva e aggiorno la grafica
swDraw.ClearSelection2 True
swDraw.WindowRedraw
End If
End If
Next vSheetName
'Riattivo il foglio iniziale, altrimenti rimane sull'utimo foglio
bRet = swDraw.ActivateSheet(Nsheet)
End Sub