remove all formatting of MText

remove all formatting of MText

hari.ramalingam
Participant Participant
302 Views
1 Reply
Message 1 of 2

remove all formatting of MText

hari.ramalingam
Participant
Participant

Hi all,

 

Is it possible to achieve remove all formatting of Mtext using VBA?.

 

WE got a lisp routine and its not working for certain dwgs whereas work for certain dwgs

 

thanks

Hari R.

0 Likes
303 Views
1 Reply
Reply (1)
Message 2 of 2

Ed__Jobe
Mentor
Mentor

The best way is to use REGEX. Here's a sample I was playing with some time ago. You may need to fine tune it to fit your needs. Your project needs to reference "Microsoft VBScript Regular Expressions 5.5".

 


Sub RegexTestMtext()
    Dim rg As New RegExp
    Dim str As String
    With rg
        .Global = True
        .MultiLine = True
        .IgnoreCase = False
        .Pattern = "\\[A-Za-z0-9.\/\#\^]+;"
    End With
    str = "{\fArial|b0|i0|c0|p34;weight}"
    If rg.test(str) Then
        Debug.Print rg.Replace(str, "$1")
    Else
        Debug.Print "No Match"
    End If
End Sub

 

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes