Code:
Option ExplicitDim Suche As String
Dim Ersetze As String
Private Sub InitStrings()
Suche = "$PRPSHEET:" + Chr(34) + "Description" + Chr(34)
Ersetze = "$PRP:" + Chr(34) + "Description2" + Chr(34)
End Sub
Private Sub DoReplaceString(ByRef sNoteText As String)
sNoteText = Replace(sNoteText, Suche, Ersetze, 1, -1, vbTextCompare)
End Sub
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc
Dim swDraw As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Dim swNote As SldWorks.Note
Dim sNoteText As String
Dim nTextCount As Long
Dim i As Long
InitStrings
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
Set swDraw = swModel
Set swView = swDraw.GetFirstView
While Not swView Is Nothing
Set swNote = swView.GetFirstNote
While Not swNote Is Nothing
If swNote.IsCompoundNote Then
nTextCount = swNote.GetTextCount
For i = 1 To nTextCount
sNoteText = swNote.GetTextAngleAtIndex(i)
DoReplaceString sNoteText
swNote.SetTextAtIndex i, sNoteText
Next i
Else
sNoteText = swNote.GetText
DoReplaceString sNoteText
swNote.SetText sNoteText
End If
Set swNote = swNote.GetNext
Wend
Set swView = swView.GetNextView
Wend
End Sub