创建新的宏名为所有表格按照窗口自动调整宽度,代码如下:
Sub 所有表格按照窗口自动调整宽度()
Application.Browser.Target = wdBrowseTable
For i = 1 To ActiveDocument.Tables.count
ActiveDocument.Tables(i).AutoFitBehavior (wdAutoFitContent) '根据内容自动调整表格
ActiveDocument.Tables(i).AutoFitBehavior (wdAutoFitWindow) '根据窗口自动调整表格
ActiveDocument.Tables(i).Range.ParagraphFormat.Alignment = wdAlignParagraphCenter '水平居中
ActiveDocument.Tables(i).Range.ParagraphFormat.Alignment = wdCellAlignVerticalCenter '垂直居中
Next i
End Sub
第二章 word宏使用技巧之文档全部表格根据窗口调整宽度
最新推荐文章于 2024-10-23 00:56:13 发布