主题:vb调用word的问题
Option Explicit
Dim aword As Word.Application
Private Sub Command1_Click()
Set aword = New Word.Application
With aword
.Visible = True
.Activate
.Documents.Add
.Selection.TypeParagraph
.Selection.Tables.Add Range:=Selection.Range, numrows:=4, numcolumns:=6
.Selection.Style = "网格型"
End With
'第一次编译正常,不关掉窗体,再点按钮就说"add方法失败",这是为什么啊
End Sub
Dim aword As Word.Application
Private Sub Command1_Click()
Set aword = New Word.Application
With aword
.Visible = True
.Activate
.Documents.Add
.Selection.TypeParagraph
.Selection.Tables.Add Range:=Selection.Range, numrows:=4, numcolumns:=6
.Selection.Style = "网格型"
End With
'第一次编译正常,不关掉窗体,再点按钮就说"add方法失败",这是为什么啊
End Sub