|
本帖最后由 pipiludaxian 于 2014-11-20 23:51 编辑
找个配置高些的电脑,速度也可以。运行前,请讲第一段的下划线删除,变为开发企业情况
Sub test001()
Dim MyXL As Object
Dim i As Integer
On Error Resume Next
ActiveDocument.Content.Copy
For n = 1 To 10 '请将10改为你需要的表格数量
ActiveDocument.ActiveWindow.ActivePane.Pages(n).Rectangles(1).Range.Paste
Next
Application.ScreenUpdating = False
Set MyXL = GetObject("C:\Documents and Settings\Administrator\桌面\根据word表格中企业名称\kkk.xls") '请改成自己的文件名
MyXL.Application.Visible = False
For i = 3 To 13
mystr = MyXL.sheets(1).Cells(i, 2)
With ActiveDocument.ActiveWindow.ActivePane.Pages(i - 2).Rectangles(1).Range
.Paragraphs(1).Range.Characters(3).Select
With Selection
.Collapse wdCollapseEnd
.InsertAfter mystr
.font.Underline = wdUnderlineSingle
End With
.Tables(1).Cell(1, 2).Range.Text = MyXL.sheets(1).Cells(i, 2)
.Tables(1).Cell(1, 4).Range.Text = MyXL.sheets(1).Cells(i, 3)
End With
Next
Set MyXL = Nothing
Application.ScreenUpdating = True
End Sub
|
|