VB中调用WORD,在WORD中生成表格,如何控制表格位置?

2024-12-19 18:10:08
推荐回答(1个)
回答1:

下面的代码是把新建文档里开头的那个表格插入并移动到第5行,不明白的百度HI我
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=4, NumColumns:= _
4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With Selection.Tables(1)
If .Style <> "Table Grid" Then
.Style = "Table Grid"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = False
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = False
End With
Selection.SplitTable
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph