- Option Explicit
- ' written by Bryco
- Function UnformatMtext(S As String) As String
- Dim P1 As Integer
- Dim P2 As Integer, P3 As Integer
- Dim intStart As Integer
- Dim strCom As String
- Dim strReplace As String
- Debug.Print S
- Select Case Left(S, 4)
- Case "\A0;", "\A1;", "\A2;"
- S = Mid(S, P1 + 5)
- End Select
- intStart = 1
- Do
- P1 = InStr(S, "%%")
- If P1 = 0 Then
- Exit Do
- Else
- Select Case Mid(S, P1 + 2, 1)
- Case "P"
- S = Replace(S, "%%P", "+or-")
- Case "D"
- S = Replace(S, "%%D", " deg")
- End Select
- End If
- Loop
- Do
- P1 = InStr(intStart, S, "", vbTextCompare)
- If P1 = 0 Then Exit Do
- strCom = Mid(S, P1, 2)
- Select Case strCom
- Case "\p"
- P2 = InStr(1, S, ";")
- S = Mid(S, P2 + 1)
- Case "\A", "\C", "\f", "\F", "\H", "\Q", "\T", "\W"
- P2 = InStr(P1 + 2, S, ";", vbTextCompare)
- P3 = InStr(P1 + 2, S, strCom, vbTextCompare)
- If P3 = 0 Then
- S = Left(S, P1 - 1) & Mid(S, P2 + 1)
- End If
- Do While P3 > 0
- P2 = InStr(P3, S, ";", vbTextCompare)
- S = Left(S, P3 - 1) & Mid(S, P2 + 1)
- 'Debug.Print s, strCom
- P3 = InStr(1, S, strCom, vbTextCompare)
- Loop
- 's = Left(s, P3 - 1) & mid(s, P3 + 1)
- 'Case "\L", "\O"
- 'Dim strLittle As String
- 'strLittle = LCase(strCom)
- 'P2 = InStr(P1 + 2, S, strLittle, vbTextCompare)
- 'S = Left(S, P1 - 1) & Mid(S, P1 + 2, P2 - (P1 + 2)) & Mid(S, P2 + 2)
- '//============== fixed by fla_2
- '// example {\fArial|b1|i0|c0|p34;\LGENERAL NOTES :}
- Case "\L", "\O"
- Dim strLittle As String
- strLittle = LCase(strCom)
- P2 = InStr(P1 + 2, S, strLittle, vbTextCompare)
- If P2 = 0 Then
- S = Left(S, P1 - 1) & Mid(S, P1 + 2)
- Else
- S = Left(S, P1 - 1) & Mid(S, P1 + 2, P2 - (P1 + 2)) & Mid(S, P2 + 2)
- End If
- '//==============
- Case "\S"
- P2 = InStr(P1 + 2, S, ";", vbTextCompare)
- P3 = InStr(P1 + 2, S, "/", vbTextCompare)
- If P3 = 0 Or P3 > P2 Then
- P3 = InStr(P1 + 2, S, "#", vbTextCompare)
- End If
- If P3 = 0 Or P3 > P2 Then
- P3 = InStr(P1 + 2, S, "^", vbTextCompare)
- End If
- S = Left(S, P1 - 1) & Mid(S, P1 + 2, P3 - (P1 + 2)) _
- & "/" & Mid(S, P3 + 1, (P2) - (P3 + 1)) & Mid(S, P2 + 1)
- Case "\U"
- strLittle = Mid(S, P1 + 3, 4)
- Debug.Print strLittle
- Select Case strLittle
- Case "2248"
- strReplace = "ALMOST EQUAL"
- Case "2220"
- strReplace = "ANGLE"
- Case "2104"
- strReplace = "CENTER LINE"
- Case "0394"
- strReplace = "DELTA"
- Case "0278"
- strReplace = "ELECTRIC PHASE"
- Case "E101"
- strReplace = "FLOW LINE"
- Case "2261"
- strReplace = "IDENTITY"
- Case "E200"
- strReplace = "INITIAL LENGTH"
- Case "E102"
- strReplace = "MONUMENT LINE"
- Case "2260"
- strReplace = "NOT EQUAL"
- Case "2126"
- strReplace = "OHM"
- Case "03A9"
- strReplace = "OMEGA"
- Case "214A"
- strReplace = "PROPERTY LINE"
- Case "2082"
- strReplace = "SUBSCRIPT2"
- Case "00B2"
- strReplace = "SQUARED"