VBA关于word的问题
Private Sub Command1_Click()
Dim docDocument As Document
Dim NumRows As Integer
Dim docTable As Word.Table
Dim iCount As Integer
Dim docRange As Word.Range
Dim docCell As Word.Cell
Set docApp = CreateObject("Word.Application")
'Dim docWord As Object
'Set docWord = CreateObject("Word.Basic")
Set docDocument = docApp.Documents.Add
Set docDocument = docApp.ActiveDocument
'Set docTable = docDocument.Tables \'--->类型不匹配???
'Set docRange = docTable.Range
'
docApp.Visible = True
Set docTable = docDocument.Tables.Add(docDocument.Range(2, 2), 5, 6) '---》=。数值超出范围???
For Each oCell In docTable.Range.Cells
oCell.Range.InsertAfter "第 " & iCount & "单元格"
iCount = iCount + 1
Next
docDocument.SaveAs App.Path & "\\123.doc"
docApp.Quit
Set docApp = Nothing
以下这两个问题怎么解决呀?很急人
数值超出范围???
--->类型不匹配???