標題: 如何將excel Range(a1) 貼到 word 上 [打印本頁] 作者: user999 時間: 2011-10-13 08:32 標題: 如何將excel Range(a1) 貼到 word 上
Private Sub CommandButton1_Click()
Dim myTmpFName As String
myTmpFName = ThisWorkbook.Path & Application.PathSeparator _
& "test文件.dot"
With New Word.Application
With .Documents.Add(myTmpFName)
.Unprotect
.Tables(2).Cell(1, 1).Range.Text = Worksheets("sheet1").Range(a1)
.Protect wdAllowOnlyFormFields
End With
.Visible = True
End With
End Sub