一种解决方案可能是利用您的需求剪贴板。这不像Excel中那么容易,但对你而言可能足够快。下面是一些示例代码如何打通剪贴板一些文本2×3字表(添加到微软引用窗体2.0对象库到您的VBA DOC):
Dim oData As New DataObject
Dim sText As String
' Navigate to the top-left cell of your table (just an example)
Selection.HomeKey Unit:=wdStory
' Put text to the clipboard
sText = "X1" & vbTab & "B1" & vbTab & "C1" & vbCrLf
sText = sText & "A2" & vbTab & "B2" & vbTab & "C2" & vbCrLf
On Error Resume Next
oData.SetText sText
oData.PutInClipboard
On Error GoTo 0
' Select the needed rows and columns of the table'
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.MoveRight Unit:=wdCharacter, Count:=2, Extend:=wdExtend
' Paste the clipboard to the table '
Selection.Paste
我建议你适应这个放的任意的二维数组放入一个字符串中并以类似的方式粘贴。如果你需要更多的帮助,请回来给我们更多的细节。
我不认为在Word中有类似的方法(至少,我不知道一个),但也许你可以告诉我们你的迭代解决方案,为什么它太慢,那么你可能会得到一些提示锄头来改善这一点。 – 2010-11-28 15:33:31