* 楼主,你好!大神 不敢当! 杜先生及各位都是才是大神哩!
* 请备份好原始文件后复制一份来测试,表内表外日期均处理(请删除第1版代码)。
- Sub aaaa????????????_v2()
- Dim s$, v&
- With ActiveDocument.Content.Find
- .ClearFormatting
- .Text = "[0-9]{1,2}-[A-Za-z]{3}-[0-9]{4}"
- .Forward = True
- .MatchWildcards = True
- Do While .Execute
- With .Parent
- s = .Text
- v = Len(s)
- If v = 10 Then
- s = Right(s, 4) & "??" & Mid(s, InStr(s, "-") + 1, 3) & Left(s, 1) & "??"
- Else
- s = Right(s, 4) & "??" & Mid(s, InStr(s, "-") + 1, 3) & Left(s, 2) & "??"
- End If
- s = Replace(s, "JAN", "1??")
- s = Replace(s, "FEB", "2??")
- s = Replace(s, "MAR", "3??")
- s = Replace(s, "APR", "4??")
- s = Replace(s, "MAY", "5??")
- s = Replace(s, "JUN", "6??")
- s = Replace(s, "JUL", "7??")
- s = Replace(s, "AUG", "8??")
- s = Replace(s, "SEP", "9??")
- s = Replace(s, "OCT", "10??")
- s = Replace(s, "NOV", "11??")
- s = Replace(s, "DEC", "12??")
-
- s = Replace(s, "Jan", "1??")
- s = Replace(s, "Feb", "2??")
- s = Replace(s, "Mar", "3??")
- s = Replace(s, "Apr", "4??")
- s = Replace(s, "May", "5??")
- s = Replace(s, "Jun", "6??")
- s = Replace(s, "Jul", "7??")
- s = Replace(s, "Aug", "8??")
- s = Replace(s, "Sep", "9??")
- s = Replace(s, "Oct", "10??")
- s = Replace(s, "Nov", "11??")
- s = Replace(s, "Dec", "12??")
- .Text = s
- .Font.Color = wdColorRed '????????д?????????
- .Start = .End
- End With
- Loop
- End With
- '''
- With ActiveDocument.Content.Find
- .ClearFormatting
- .Text = "[A-Za-z]{3}-[0-9]{4}"
- .Forward = True
- .MatchWildcards = True
- Do While .Execute
- With .Parent
- If Len(.Paragraphs(1).Range.Text) > 10 Then GoTo sk
- s = .Text
- s = Right(s, 4) & "??" & Left(s, 3)
- s = Replace(s, "JAN", "1??")
- s = Replace(s, "FEB", "2??")
- s = Replace(s, "MAR", "3??")
- s = Replace(s, "APR", "4??")
- s = Replace(s, "MAY", "5??")
- s = Replace(s, "JUN", "6??")
- s = Replace(s, "JUL", "7??")
- s = Replace(s, "AUG", "8??")
- s = Replace(s, "SEP", "9??")
- s = Replace(s, "OCT", "10??")
- s = Replace(s, "NOV", "11??")
- s = Replace(s, "DEC", "12??")
-
- s = Replace(s, "Jan", "1??")
- s = Replace(s, "Feb", "2??")
- s = Replace(s, "Mar", "3??")
- s = Replace(s, "Apr", "4??")
- s = Replace(s, "May", "5??")
- s = Replace(s, "Jun", "6??")
- s = Replace(s, "Jul", "7??")
- s = Replace(s, "Aug", "8??")
- s = Replace(s, "Sep", "9??")
- s = Replace(s, "Oct", "10??")
- s = Replace(s, "Nov", "11??")
- s = Replace(s, "Dec", "12??")
- .Text = s
- .Font.Color = wdColorPink '??????д?????????
- sk:
- .Start = .End
- End With
- Loop
- End With
- '0X??0X???滻
- With ActiveDocument.Content.Find
- .Execute "(0)([0-9]??)", , , 1, , , , , , "\2", 2
- .Execute "(0)([0-9]??)", , , 1, , , , , , "\2", 2
- End With
- MsgBox "OK!!!!!!!!!!!!!!!!!!!!!", 0 + 48
- End Sub
复制代码 |