|
参考sylun兄写的代码:(单击"帮助"后面的"统一英语对话样式及对齐"按钮)
Sub 统一英语对话样式及对齐()
Dim p As Paragraph, myRange As Range, myend As Long, myInfo As Long
Dim pl As Long, pt As Long, pw As Long, ph As Long
Application.ScreenUpdating = False
Set myRange = IIf(Selection.Type = wdSelectionIP, ActiveDocument.Content, Selection.Range)
With myRange.Find
.ClearFormatting
.MatchWildcards = True
.Text = "([.^13])[-—]{1,}"
.Execute replacewith:="\1—", Replace:=wdReplaceAll
.Execute findtext:="([.^13])[A-C][::]", Replace:=wdReplaceAll
myend = myRange.End
.Replacement.Text = ""
Do While .Execute("^13—")
With .Parent
.Select
If InStr(.Paragraphs(1).Range.Text, "—") Then
ActiveDocument.ActiveWindow.GetPoint pl, pt, pw, ph, _
.Paragraphs(1).Range.Characters(InStr(.Paragraphs(1).Range.Text, "—"))
myInfo = pl
ActiveDocument.ActiveWindow.GetPoint pl, pt, pw, ph, .Paragraphs(1).Range.Characters(1)
.Paragraphs(2).LeftIndent = PixelsToPoints(myInfo - pl)
End If
.SetRange .End, myend
End With
Loop
End With
Application.ScreenUpdating = True
End Sub |
|