-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReplaceMathML.vb
More file actions
33 lines (27 loc) · 956 Bytes
/
ReplaceMathML.vb
File metadata and controls
33 lines (27 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Sub ReplaceMathML()
Dim nNumber As Integer
Dim strMath As String
Dim objData As New MSForms.DataObject
Dim oRange As Range
If ActiveDocument.OMaths.Count > 0 Then
With ActiveDocument
For nNumber = 1 To .OMaths.Count Step 1
.OMaths(1).Range.Select
Set oRange = .OMaths(1).Range
Selection.Copy
objData.GetFromClipboard
strMath = Replace(objData.GetText(), "mml:", "")
strMath = Replace(strMath, " xmlns:mml=""http://www.w3.org/1998/Math/MathML"" xmlns:m=""http://schemas.openxmlformats.org/officeDocument/2006/math""", "")
oRange.Select
Selection.Next.Select
.OMaths(1).Range.Select
Selection.Delete
Selection.EndOf
oRange.Select
Selection.InsertAfter (" " + strMath + " ")
Next nNumber
End With
Else
MsgBox ("No math")
End If
End Sub