|
- Sub shishi()
- Dim pt$, f$, wd As Object, n&, m&, wdapp As Object
- Dim Arng As Object, oRang As Object, mt
- Application.ScreenUpdating = False
- Set wdapp = CreateObject("Word.Application")
- wdapp.Visible = False
- pt = ThisWorkbook.Path & ""
- f = Dir(pt & "*.doc*")
- Do While f <> ""
- Set wd = wdapp.Documents.Open(pt & f, Visible:=False)
- Set Arng = wd.Content
- With CreateObject("vbscript.regexp")
- .Pattern = "[a-zA-Z0-9]+"
- .Global = True: .IgnoreCase = False
- For Each mt In .Execute(Arng)
- m = mt.FirstIndex: n = mt.Length
- Set oRang = wd.Range(m, m + n)
- oRang.Font.Name = "Times New Roman"
- Next
- End With
- wd.Close True
- f = Dir
- Loop
- wdapp.Quit
- MsgBox "操作完毕!"
- Application.ScreenUpdating = True
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|