1

VBA MS Word 2003 ドキュメントで、すべての上げ下げ文字上付き文字/下付き文字に変更するにはどうすればよいですか?

私の機能しないコード:

Public Sub Normalize_Position()
    Application.ScreenUpdating = False

    Dim uVals() As Variant
    Dim Rng As Range

    'All these values are font positions
    uVals = Array(0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5)


    For v = 0 To UBound(uVals)

        With Selection
            .HomeKey Unit:=wdStory

            Set Rng = ActiveDocument.Range
            Rng.Collapse Direction:=wdCollapseStart

            Rng.Find.ClearFormatting
            Rng.Find.Font.position = uVals(v)
            Rng.Find.Replacement.ClearFormatting
            With Rng.Find
                .Text = ""
                .Replacement.Text = ""
                .Replacement.Font.position = 0
                .Replacement.Font.Superscript = 1
                .Replacement.Font.Color = wdColorRose
                .Forward = True
                .Wrap = wdFindContinue
                .Format = True
                .MatchCase = False
                .MatchWholeWord = False
                .MatchWildcards = False
                .MatchSoundsLike = False
                .MatchAllWordForms = False
            End With
            Rng.Find.Execute Replace:=wdReplaceAll

        End With
    Next

    Application.ScreenUpdating = True
    'Free up memory
    ActiveDocument.UndoClear
    Debug.Print "Normalize font position Finished.!"
End Sub
4

1 に答える 1