|
- Sub 汇总()
- Dim MyFile$, MyName$, i%, j%, x%, MyDoc As Document, arr
- MyFile = ThisDocument.Path & ""
- MyName = Dir(MyFile & "*.doc")
- arr = Array("语文", "数学", "英语")
- Application.ScreenUpdating = False
- Do While MyName <> ""
- If MyName <> ThisDocument.Name Then
- Set MyDoc = Documents.Open(MyFile & MyName)
- For x = 0 To UBound(arr)
- If InStr(MyDoc.Name, arr(x)) Then x = x + 2: Exit For
- Next
- With ThisDocument
- For i = 1 To ActiveDocument.Tables.Count
- For j = 1 To ActiveDocument.Tables(i).Rows.Count - 1
- .Tables(i).Cell(j, x).Range.Text = ActiveDocument.Tables(i).Cell(j, x).Range.Text
- Next
- Next
- End With
- MyDoc.Close False
- End If
- MyName = Dir
- Loop
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|