1 Sub Replace_m3_to_supscript() 2 Dim sld As Slide 3 Dim shp As Shape 4 Dim txtRng As TextRange 5 Dim i As Long 6 For Each sld In ActivePresentation.Slides 7 For Each shp In sld.Shapes 8 If shp.HasTextFrame And shp.TextFrame.HasText Then 9 Set txtRng = shp.TextFrame.TextRange 10 For i = 1 To Len(txtRng) 11 If Mid(txtRng, i, 1) = "m" Then 12 If Mid(txtRng, i + 1, 1) = "3" Then 13 txtRng.Characters(i + 1, 1).Font.Superscript = msoTrue 14 End If 15 End If 16 Next i 17 End If 18 Next shp 19 Next sld 20 End Sub
如要设置下标,则改txtRng.Characters(i + 1, 1).Font.Subscript = msoTrue