匆匆做了一个,不太好。 陈兄如果要用的话,先用着。Option Explicit
Sub 排1()
Dim apar As Paragraph
Dim arange As Range, brange As Range, a%, b%
Dim x%
'这个是主程序,运行它就行了!
'要选中某个区域,才行,否则,错
自动去段落
On Error Resume Next
Application.ScreenUpdating = False
For Each apar In Selection.Paragraphs
If apar.Range.Characters(1) Like "A" Then
a = apar.Range.Information(wdFirstCharacterLineNumber)
Set brange = ActiveDocument.Range(apar.Range.End, apar.Range.End)
b = brange.Information(wdFirstCharacterLineNumber)
x = b - a
Select Case x
Case 0
'不做任何处理,即全部在第一行
Case 1
'做处理2,分为二行
With apar.Range.Find
.Text = "(*^t*)(^t)"
.MatchWildcards = True
With .Replacement
.Text = "\1^p"
End With
.Execute Replace:=wdReplaceAll, Forward:=True
End With
Case 2
'做处理3,分成三行
With apar.Range.Find
.Text = "^t"
.MatchWildcards = True
With .Replacement
.Text = "^p"
End With
.Execute Replace:=wdReplaceAll, Forward:=True
End With
'做处理3
End Select
End If
Next
自动A
Application.ScreenUpdating = True
End Sub
Sub 自动去段落()
With Selection.Find
.Text = "([A-C]、*)^13"
.MatchWildcards = True
With .Replacement
.Text = "\1^t"
End With
.Execute Replace:=wdReplaceAll, Forward:=True
End With
End Sub
Sub 自动A()
Dim apar As Paragraph
For Each apar In Selection.Paragraphs
If apar.Range.Characters(1) Like "C" And Len(apar.Range.Text) < 25 Then
With apar.Find
.Text = "^t"
.MatchWildcards = True
With .Replacement
.Text = "^t^t"
End With
.Execute Replace:=wdReplaceAll, Forward:=True
End With
Next
End Sub
[此贴子已经被作者于2006-3-9 22:33:00编辑过] |