AnsweredAssumed Answered

Macro Find Notes on Drawing and Move Location

Question asked by James Dickson on Apr 9, 2020

I have this macro that will find the notes on drawing but getting an error because it's not checking the "Note" annotation filter box.  

 

I thought the code below should check the box but not working.

"swUtilFindReplaceAnnotations.AnnotationFilter = gtFraNote"

 

Thanks for any help you can give.

 

****************************************************************************************************************

Private Sub CommandButton_Move_Notes_Click()

 

Dim swApp As Object

Dim oData As New DataObject 'object to use the clipboard

Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc


If Update_Format.ComboBoxCurrentSheetSize.Value = "" Then

MsgBox "Select Currnt Sheet Size Before Performing Action"

Else

If Update_Format.ComboBoxCurrentSheetSize.Value = "DONE" Then

MsgBox "Select A New Currnt Sheet Size Before Performing Action"

Else

If Update_Format.ComboBoxCurrentSheetSize.Value = "D" Then

'----------------------------------------
Set swUtil = swApp.GetAddInObject("Utilities.UtilitiesApp")
Set swUtilFindReplaceAnnotations = swUtil.FindReplaceAnnotations

' Redraw
Part.GraphicsRedraw2
longstatus = swUtilFindReplaceAnnotations.InitPMPage()
'----------------------------------------
#If 0 Then
#End If
'--------------------------------------
swUtilFindReplaceAnnotations.FindText = "NOTES:"
swUtilFindReplaceAnnotations.AnnotationFilter = gtFraNote
longstatus = swUtilFindReplaceAnnotations.FindNext()
'----------------------------------------
#If 0 Then
#End If
'--------------------------------------
longstatus = swUtilFindReplaceAnnotations.Close()
Part.EditCopy
Part.EditDelete
boolstatus = Part.Extension.SelectByID2("Sheet 1", "SHEET", 1.45053289166621E-02, 0.538618800586526, 0, False, 0, Nothing, 0)
Part.Paste

oData.SetText Text:=Empty 'Clear
oData.PutInClipboard 'take in the clipboard to empty it

ComboBoxCurrentSheetSize.Value = "DONE"

End If

End If

End If

End Sub

Outcomes