word表格格式统一设置宽度教程
时间:2023-08-03 20:08:41
Word表格可根据窗口自动调整表格宽度,使得所有的表格宽度和页面宽度一样。当页面设置了新的页边距后,所有的表格都需要调整新的宽度。下面给大家分享word批量修改表格的宽度的方法。
word批量修改表格的宽度的方法
第一步:打开Word文档,按下【Alt + F11】
第二步:在VBA编辑器窗口的左上方,双击【ThisDocument】
第三步:在右侧选择【Document】,再在其右侧下拉选择【Open】
第四步:然后在宏代码编辑窗口中,Document_Open()下面输入以下代码
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
第五步:点击左上方的保存图标。
第六步:在弹出的窗口中,点击【否】,如果文档已经启用了宏,就不会出现这个提示对话框了。
第七步:将文档另存为【启用宏的 Word 文档】,然后关闭VBA编辑器和当前文档。
第八步:找到你刚刚保存的启用宏的Word文档,双击打开,启用宏的Word文档的图标上,会有一个感叹号。
第九步:点击【启用内容】,宏代码开始运行。
第十步:您会发现,Word中的所有表格,都会自动调整其宽度与页面宽度一样啦,而且表格中的内容都居中对齐了。如果不希望居中对齐,就将宏代码中的水平居中和垂直居中两行去掉。
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
excel怎么设置自动计算
![](https://img.aspxhome.com/file/2023/8/a142868_0s.png)
Win7系统桌面出现一个白色框框无法关闭的故障分析及解决方法
![](https://img.aspxhome.com/file/2023/28/a245556_0s.jpg)
WPS文档怎么加密? WPS加密文件的详细教程
![](https://img.aspxhome.com/file/2023/0/a166710_0s.jpg)
福昕阅读器如何将PDF转换成图片?
![](https://img.aspxhome.com/file/2023/7/a330352_0s.jpg)
在FireFox浏览器中如何设置使用严格的跟踪保护功能?
![](https://img.aspxhome.com/file/2023/3/a205043_0s.jpeg)
App Store 无法正常下载应用,一直转圈的处理办法
![](https://img.aspxhome.com/file/2023/8/a196378_0s.jpg)
谷歌浏览器0xc000007b-谷歌浏览器0xc000007b解决方法
![](https://img.aspxhome.com/file/2023/4/a305334_0s.png)
VMware虚拟机找不到USB设备该怎么办?
![](https://img.aspxhome.com/file/2023/5/a319105_0s.jpg)
xbox控制台截图_xbox控制台截图使用方法
![](https://img.aspxhome.com/file/2023/3/a293236_0s.jpg)
xbox控制台小帮手是什么软件?xbox控制台小帮手有什么用?
![](https://img.aspxhome.com/file/2023/30/a267484_0s.jpg)
WPS动画制作仿Windows 7对话框
![](https://img.aspxhome.com/file/2023/7/a165227_0s.gif)
Win8.1 32位和64位的区别 32位和64哪个好?
![](https://img.aspxhome.com/file/2023/3/a300405_0s.jpg)
网页弹窗广告怎么解决?如何禁止网页弹出广告
![](https://img.aspxhome.com/file/2023/1/a273862_0s.jpg)
在Excel中怎么查询有效数据?Excel有效数据查询方法
![](https://img.aspxhome.com/file/2023/3/a153493_0s.jpg)
word文档怎么安装字体样式?怎么给word安装新字体?
![](https://img.aspxhome.com/file/2023/30/a263771_0s.png)
在word中怎么统计每个词语的数量?
![](https://img.aspxhome.com/file/2023/5/25525_0s.jpg)
苹果电脑分区相关操作教程
![](https://img.aspxhome.com/file/2023/6/a210856_0s.png)
运行Word总默认打开上次文档怎么办?
电脑桌面图标太小怎么办 Win7系统修改图标大小的方法
![](https://img.aspxhome.com/file/2023/2/a291904_0s.jpg)