WordVBAで表の操作
アクティブなページのテーブルを選択
'アクティブなページのテーブルを選択する。
With ActiveDocument.Bookmarks("\Page").Range.Tables
If .Count = 0 Then Exit Sub
.Item(1).Select
End With
表内の文字サイズ,デザイン,行間の指定
'例はサイズ7p , デザインは"MS Pゴシック"
With Selection.Range.Font
.Size = 7
.Name = "MS Pゴシック"
End With
'例は行間8p固定
With Selection.ParagraphFormat
.LineSpacingRule = wdLineSpaceExactly
.LineSpacing = 8
End With
表内の全セルを垂直方向中央揃え
Dim rowMax As Long, i As Long
rowMax = ActiveDocument.Bookmarks("\Page").Range.Tables.Item(1).Rows.Count
For i = 1 To rowMax
With ActiveDocument.Bookmarks("\Page").Range.Tables.Item(1).Rows(i)
.Cells.VerticalAlignment = wdCellAlignVerticalCenter
End With
Next
行の高さを変更
'1行目を7.5mmに変更
Call ActiveDocument.Bookmarks("\Page").Range.Tables.Item(1).Rows(1).SetHeight(MillimetersToPoints(7.5), wdRowHeightExactly)
列の幅を変更
'1列目を8mmに変更
Call ActiveDocument.Bookmarks("\Page").Range.Tables.Item(1).Columns(1).SetWidth(MillimetersToPoints(8), wdAdjustNone)
Author And Source
この問題について(WordVBAで表の操作), 我々は、より多くの情報をここで見つけました https://qiita.com/YuichiTanaka007/items/cd2161ddd84fe8f13a76著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .