0

我在 ms-word 2007 中使用宏

我必须找到双字母。例如:苹果中的PP,访问中的cc和ss(来自“aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr ,ss,tt,uu,vv,ww,xx,yy,zz") 并将上述双字母字体格式化为比例 - 75% ,间距 - 扩展 ,By - 0.5pt

我有 vb 代码来突出显示双字母,但我没有代码来选择并将上述双字母字体格式化为比例 - 75%,间距 - 扩展,按 - 0.5pt

Sub Macro_test()
'
' Macro_alphabet Macro
'
'
Application.ScreenUpdating = False
Dim StrFnd As String, Rng As Range, i As Long
StrFnd = "aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,ll,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv,ww,xx,yy,zz"
For i = 0 To UBound(Split(StrFnd, ","))
  Set Rng = ActiveDocument.Range
  With Rng.Find
    .ClearFormatting
    .text = Split(StrFnd, ",")(i)
    .Replacement.ClearFormatting
    .Replacement.Highlight = True
    .Replacement.text = "^&"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute Replace:=wdReplaceAll
    Selection.Range.HighlightColorIndex = wdNoHighlight
  End With
Next
Set Rng = Nothing
Application.ScreenUpdating = True
End Sub
4

1 回答 1

0

正如 PeterL 所提到的,您可以只录制一个宏。

这是它的样子

        With Selection.Font
            .Spacing = 0.5
            .Scaling = 75
        End With

您可能需要将 ths 稍微修改为“with rng.font”或类似内容以匹配您的选择方法。

于 2013-02-07T17:35:18.103 回答