是MTEXT吗?试试这个
Public Function GetMTextUnformatString(ByVal str As String) As String '程序功能:按给定的MText字符串返回可用的字符串 On Error Resume Next Dim pStrs As New Collection Dim pStack As Collection Dim n As Integer Dim pStr As String Dim pEnd As String str = "{" & str & "}" Do While Len(str) > 0 n = IIf(Left(str, 1) = "\", 2, 1) pStr = Left(str, n) '分割MText字符串为控制字符或单个字符 If pStr = "}" Then '遇"}"时出栈,直到"{" pEnd = pStrs(pStrs.Count) Set pStack = New Collection pStack.Add "*TlsCad*" Do While pEnd <> "{" pStack.Add pEnd, , 1 pStrs.Remove pStrs.Count pEnd = pStrs(pStrs.Count) Loop pStrs.Remove pStrs.Count pStack.Remove pStack.Count For Each i In GetRtfString(pStack) '调用GetRtfString函数返回可用的字符集合 pStrs.Add i Next i Else '当前字符入栈 pStrs.Add Left(str, n) End If str = Right(str, Len(str) - n) Loop For Each i In pStrs '合并字符集合为字符串 If Len(i) = 2 Then '处理\、{、} GetMTextUnformatString = GetMTextUnformatString & Right(i, 1) Else GetMTextUnformatString = GetMTextUnformatString & i End If Next i End Function |