|
通过EXCEL写的。
Sub FindWordPageToExcel()
Dim objDoc As Object, WdFileName As Variant, Ei%, F As Object
Range("A2:C100").ClearContents
On Error Resume Next
WdFileName = Application.GetOpenFilename("Word files,*.doc?", , "Browse for file containing table to be imported")
If WdFileName = False Then Exit Sub
Set objDoc = GetObject(WdFileName)
Ei = 2
T = Timer '//开始时间
Set F = objDoc.Content.Find
F.Text = [G2]
F.Highlight = True
F.MatchWildcards = [H2] '使用通配符”
Do While F.Execute
F.Parent.Copy
Cells(Ei, 1) = Ei - 1
Cells(Ei, 2).PasteSpecial xlPasteValues
Cells(Ei, 3) = F.Parent.Paragraphs(1).Range.Information(3)
Ei = Ei + 1
Loop
objDoc.Close False
Cells(2, 4) = Format(Timer - T, "#0.00")
MsgBox "一共用时:" & Format(Timer - T, "#0.0000") & " 秒"
End Sub
|
评分
-
1
查看全部评分
-
|