* 谢谢 wdpfox 朋友,我认为年月日是突破点。
* 楼主,可能运行较慢,请耐心等待一会儿就好。请注意留底(打包原文件备份保存)。
*- Sub aaaa日记整理()
- Dim i As Paragraph
- With ActiveDocument
- With .Content.Find
- .Execute "[^13^l]", , , 1, , , , , , "", 2
- .Execute "\(", , , 1, , , , , , "(", 2
- .Execute "\)", , , 1, , , , , , ")", 2
- With .Parent
- .Select
- Selection.ClearFormatting
- With .Font
- .NameFarEast = "宋体"
- .NameAscii = "Times New Roman"
- .Size = 16
- .Color = wdColorBlue
- .Kerning = 0
- .DisableCharacterSpaceGrid = True
- End With
- With .ParagraphFormat
- .Space15
- .CharacterUnitFirstLineIndent = 2
- .AutoAdjustRightIndent = False
- .DisableLineHeightGrid = True
- End With
- End With
- .Execute "([0-9]{2,4}.[0-9]{1,2}.[0-9]{1,2})", , , 1, , , , , , "^p^&", 2
- End With
- For Each i In .Paragraphs
- With i.Range
- If InStr(.Text, ".") = 3 Then .InsertBefore Text:="20"
- If InStr(.Text, ".") = 4 Then .InsertBefore Text:="2"
- If .Text Like "[!2]*" Then .Font.ColorIndex = wdRed 'check
- End With
- Next
- With .Content
- With .Find
- .Execute "([0-9]{4}).([0-9]{1,2}).([0-9]{1,2})", , , 1, , , , , , "\1年\2月\3日", 2
- .Execute "([。)])[!。)]@android.cursor.item[!^13]@(^13)", , , 1, , , , , , "\1\2", 2
- .Execute "(( 0 : B J ` h[!^13]@)(^13)", , , 1, , , , , , "\2", 2
- .Execute "([!^1-^127][!^1-^127])\1", , , 1, , , , , , "\1", 2
- With .Parent
- .Select
- CommandBars.FindControl(ID:=122).Execute
- CommandBars.FindControl(ID:=123).Execute
- End With
- .Execute "([!^13]@^13)\1", , , 1, , , , , , "\1", 2 'del-dup
- If MsgBox("是否在段落间留空?", 4 + 16) = vbYes Then .Execute "^p", , , 0, , , , , , "^p^p", 2
- End With
- Do While .Text Like "*" & vbCr & vbCr
- .Characters.Last.Delete
- Loop
- End With
- If MsgBox("是否标红年月日?", 4 + 16) = vbYes Then
- For Each i In .Paragraphs
- If i.Range Like "*日*" Then
- With ActiveDocument.Range(i.Range.Start, i.Range.Characters(InStr(i.Range, "日")).End).Font
- .Bold = True
- .ColorIndex = wdPink
- .Underline = wdUnderlineWavyHeavy
- End With
- End If
- Next
- End If
- End With
- With ActiveWindow.ActivePane.View.Zoom
- .PageColumns = 3
- .PageRows = 1
- End With
- With Selection
- If MsgBox("是否设置为默认格式?", 4 + 16) = vbYes Then
- .WholeStory
- .ClearFormatting
- .HomeKey 6
- End If
- End With
- End Sub
复制代码 |