@chris.slattery
The below code search for a string with the third char containing "3", and replace the third char with "-ZZ" leaving the first 2 chars of found string and from the third to total length of string as previously.
When I'm saying "rewrite" I didn't mean the command rewrite (I guess it's not existing....) but I meant assign to object found a different value. Again this is only an example, if your string to search it's not a constant you can ask on the command bar to insert the string to search or partial string to search
' Prompt & Input can contain blanks
returnString = ThisDrawing.Utility.GetString(True, "Enter text (<enter> terminates input):")
MsgBox "The string entered was '" & returnString & "'", , "GetString Example"
If ENTITY.TEXTSTRING=returnString then........
if MID$(ENTITY.TEXTSTRING, Starting point in the string, N of char) = returnString then ....
or using like
MyCheck = "aBBBa" Like "a*a" ' Returns True.
MyCheck = "F" Like "[A-Z]" ' Returns True.
MyCheck = "F" Like "[!A-Z]" ' Returns False.
MyCheck = "a2a" Like "a#a" ' Returns True.
MyCheck = "aM5b" Like "a[L-P]#[!c-e]" ' Returns True.
MyCheck = "BAT123khg" Like "B?T*" ' Returns True.
MyCheck = "CAT123khg" Like "B?T*" ' Returns False.
Sub MtextChange()
For Each ENTITY In ThisDrawing.ModelSpace 'For each entity inside modele space
If TypeOf ENTITY Is AcadMText Or TypeOf ENTITY Is AcadText Then
If Mid$(ENTITY.TextString, 3, 1) = "3" Then ' check text inside the dwg
A = Mid$(ENTITY.TextString, 1, 2)
B = Mid$(ENTITY.TextString, 4, Len(ENTITY.TextString))
ENTITY.TextString = A & "-ZZ-" & B
End If
End If
Next
ThisDrawing.Application.Update
End Sub