Hello All,
I have recorded below macro & make minor changes.
Code work well and change the Note "ABC" to "DEF"
1- Now I want to extend this code through all sheets
I have tried to extend this code to use for all sheets but it work for active sheet only.
2- All Sheet have Note "123" which I want to delete .
Please put some light on this.
' ******************************************************************************
' macro recorded on 02/08/18 by Gaurav
' ******************************************************************************
Dim swApp As Object
Dim Part As Object
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = _
Application.SldWorks
Set Part = swApp.ActiveDoc
Set swModel = swApp.ActiveDoc
Set swDraw = swModel
'boolstatus = Part.Extension.SelectByID2("Template", "SHEET", 0.2161171875, 0.2239453125, 0, False, 0, Nothing, 0)
'--------------------Find and Replace Annotations--------------------
Set swUtil = swApp.GetAddInObject("Utilities.UtilitiesApp")
Set swUtilFindReplaceAnnotations = swUtil.FindReplaceAnnotations
longstatus = swUtilFindReplaceAnnotations.InitPMPage()
'--------------------Block Recording--------------------
#If 0 Then
#End If
'--------------------UnBlock Recording------------------
swUtilFindReplaceAnnotations.FindText = "ABC"
swUtilFindReplaceAnnotations.ReplaceText = "DEF"
swUtilFindReplaceAnnotations.Options = gtFraWholeWord
swUtilFindReplaceAnnotations.AnnotationFilter = gtFraNote
Part.ClearSelection2 True
Part.ClearSelection2 True
longstatus = swUtilFindReplaceAnnotations.ReplaceAll()
'--------------------Block Recording--------------------
#If 0 Then
#End If
'--------------------UnBlock Recording------------------
longstatus = swUtilFindReplaceAnnotations.Close()
'boolstatus = Part.Extension.SelectByID2("Template", "SHEET", 0.2440078125, 0.090628125, 0, False, 0, Nothing, 0)
End Sub
'--------------------------------------------------------------
Regards,
Gaurav
SolidworksApi macros