我试着你的思路做了一下,运行一下看行否?
'* +++++++++++++++++++++++++++++ '* Created By I LOVE YOU WORD!@ExcelHome 2006-3-5 17:05:11 '仅测试于System: Windows NT Word: 11.0 Language: 2052 '№ 0031^The Code CopyIn [ThisDocument-ThisDocument]^' '* ----------------------------- Option Explicit
Sub Example() Dim FieldText As String, FileName As String Dim i As Byte, j As Byte, myTable As Table Dim myRange As Range, myCell As Cell Application.ScreenUpdating = False With ActiveDocument Set myTable = .Tables(1) Set myRange = .Range(myTable.Cell(1, 1).Range.Start, myTable.Cell(44, 3).Range.End) FileName = """C:\\Documents and Settings\\CollinChow\\desktop\\[2005]\\bansh.xls""" For i = 1 To 3 For j = 1 To 44 FieldText = FileName & "sheet1R" & (j + 4) & "C" & (i + 2) & " \t \a" Set myCell = myTable.Cell(j + 4, i + 2) Set myRange = myCell.Range With myRange .Font.Size = 9 .Font.Name = "Arial Narrow" .Text = "" .SetRange .Start, .Start .Fields.Add Range:=myRange, Type:=wdFieldLink, Text:=FieldText, PreserveFormatting:=True End With Next j Next i End With Application.ScreenUpdating = True End Sub
|