VB中调用WORD,请参:
请注意:VB:工程/引用:Microsoft Word 10.0 Object Library
Private Sub Command1_Click()
Dim WdApp As Word.Application, WdDoc As Word.Document
Dim WdTable As Word.Table
'Set WdApp = CreateObject("Word.Application")
Set WdApp = New Word.Application
WdApp.Visible = True
Set WdDoc = WdApp.Documents.Add
Set WdTable = WdDoc.Tables.Add(WdApp.Selection.Range, 2, 5, wdWord9TableBehavior, wdAutoFitFixed)
With WdTable
.Style = "网格型" '设置样式
'设置列宽为2.5厘米
.Columns.Width = Application.CentimetersToPoints(2.5)
'设置行高为0.8厘米
.Rows.Height = Application.CentimetersToPoints(0.8)
End With
End Sub
'----------------------另,你的目录方法错误,插入/索引与目录/目录。如下附件:
dLd3RQke.rar
(15.63 KB, 下载次数: 16)
|