vb-word表格问题
vb保存成word,怎么在任意位置插入新的表格。还有就是每次怎么把光标移动到文档结尾处。
谢谢了
Option Explicit '引用 Microsoft Word XX.0 Object Library Dim wd As New Word.Application Dim wddoc As Word.Document Dim FileName As String Dim iPageNumber As Integer Private Sub cmdCommand1_Click() Call InsertTable(5, 6) '插入表格 Call MoveLastPlace '移到最后 Call SaveDocFile '保存Word档案 End Sub Private Sub Form_Initialize() iPageNumber = 1: FileName = "C:\1.doc" End Sub Private Sub Form_Load() wd.Documents.Add ' wd.Visible = True ' wd.DisplayAlerts = wdAlertsNone Set wddoc = wd.ActiveDocument End Sub Private Sub SaveDocFile() wddoc.SaveAs FileName wd.Quit End Sub Private Sub InsertTable(row As Integer, col As Integer) wddoc.Paragraphs.Item(iPageNumber).Range.Tables.Add wddoc.Paragraphs.Item(iPageNumber).Range, row, col '5行6列 End Sub Private Sub MoveLastPlace() wd.Selection.MoveDown Unit:=wdLine, Count:=5 '5行 End Sub