# 批量调整所有表格word 宏

**URL:** <https://forum.90sec.com/t/topic/2108>\
**Category:** 账号审核\
**Created:** [2022 年5 月 13 日 06:41 UTC](https://forum.90sec.com/t/topic/2108 "2022-05-13T06:41:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

作者： ![sun](https://forum.90sec.com/letter_avatar_proxy/v4/letter/s/49beb7/32.png) [@sun](https://forum.90sec.com/u/sun)\
发布日期： [2022 年5 月 13 日 06:41 UTC](https://forum.90sec.com/t/topic/2108/1 "2022-05-13T06:41:12Z")

</div>

Sub 批量选择所有表格()

'  
' 自动调整所有表格 宏  
'  
'Application.Browser.Target = wdBrowseTable

For i = 1 To ActiveDocument.Tables.Count

With ActiveDocument.Tables(i)  
.AutoFitBehavior (wdAutoFitWindow) '根据窗口调整内容  
.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter '水平居中  
.Range.ParagraphFormat.Alignment = wdCellAlignVerticalCenter '垂直居中  
.Borders(wdBorderHorizontal).LineStyle = wdLineStyleInset '加水平线  
End With

Next i

End Sub
