如何统一调整word文档中所有表格的宽度和高度?
时间:2022-07-08 10:45:11
今天跟大家分享如何在Word文档中批量设置不同表格的宽度和高度。下图文档中有4个表格,表格的尺寸不一致,下面我们想将所有表格整体宽度设置为15厘米,表格每行行高设为2厘米。
(如果大家的文档中表格数量更多,下文中的代码也是可以使用的。)
操作步骤:
1.在文档窗口上方的“开发工具”选项卡“代码”功能组中单击“Visual Basic”按钮。
2.在弹出的VBA编辑器窗口中执行“插入”-“模块”命令,此时在窗口中央会弹出一个代码编辑窗口。
3.在代码编辑窗口中输入如下代码:
Sub 批量选择所有表格()
Dim tempTable As Table
Application.ScreenUpdating = False
If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
MsgBox "文档已保护,此时不能选中多个表格!"
Exit Sub
End If
ActiveDocument.DeleteAllEditableRanges wdEditorEveryone
For Each tempTable In ActiveDocument.Tables
tempTable.Range.Editors.Add wdEditorEveryone
Next
ActiveDocument.SelectAllEditableRanges wdEditorEveryone
ActiveDocument.DeleteAllEditableRanges wdEditorEveryone
Application.ScreenUpdating = True
End Sub
4.单击窗口上方工具栏中的“运行子过程/用户窗体”按钮(方向向右的绿色三角符号),这样所有文档中的表格都会被选中。
5.在“表格工具”“布局”选项卡“表”功能组中单击“属性”按钮。
6.在弹出的“表格属性”对话框中,切换到“表格”选项卡,将“尺寸”设为“指定宽度”“15厘米”;再切换到“行”选项卡,将“尺寸”设为“指定高度”“2厘米”(行高值为固定值),单击“确定”按钮。
7.返回文档,可见所有表格已经统一为了我们想要的尺寸,每个表格整体宽度15厘米,每行行高2厘米。
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Word怎么快速对齐所有图片?Word文档快速对齐所有图片的方法
![](https://img.aspxhome.com/file/2023/9/30879_0s.jpg)
如何在 AirPods 上使用 Siri 信息播报功能?
![](https://img.aspxhome.com/file/2023/2/46052_0s.jpg)
Word如何自动调整文本框的大小?Word设置自动调整文本框大小方法步骤
![](https://img.aspxhome.com/file/2023/0/31440_0s.jpg)
realtek高清晰音频管理器已停止工作怎么办?
![](https://img.aspxhome.com/file/2023/9/47779_0s.jpg)
怎么屏蔽掉WPS广告弹窗?
![](https://img.aspxhome.com/file/2023/9/53469_0s.jpg)
Windows 10每次重启后自动弹Word是什么问题?Wind10每次重启后自动弹Word修复教程
![](https://img.aspxhome.com/file/2023/8/46688_0s.jpg)
如何让word文字自动变成表格?
![](https://img.aspxhome.com/file/2023/4/35854_0s.jpg)
word文档中文件怎么插入gif动图
word分数怎么打
![](https://img.aspxhome.com/file/2023/5/22945_0s.jpg)
如何在Microsoft Word中更改段落行距?
![](https://img.aspxhome.com/file/2023/0/23000_0s.jpg)
如何删除Word 里最近使用过的文档
![](https://img.aspxhome.com/file/2023/7/34927_0s.jpg)
如何在Word 2013中设置页边距,大小和方向?
![](https://img.aspxhome.com/file/2023/9/23289_0s.jpg)
Win10屏幕刷新率如何调节?Win10屏幕刷新率调节方法介绍
![](https://img.aspxhome.com/file/2023/4/50034_0s.jpg)
word如何设置绿色背景
Word用不好,职场变考场!快来看看Word到底有多强大!
![](https://img.aspxhome.com/file/2023/9/17129_0s.jpg)
word打开报错the resource dll can not be loaded怎么办?
![](https://img.aspxhome.com/file/2023/7/30187_0s.jpg)
Word2010文档中插入纵排格式中文页码
office激活过程中提示:无法与服务器联系,请几分钟后再试
![](https://img.aspxhome.com/file/2023/8/15998_0s.jpg)
office word 2007失去焦点后鼠标不能对文档操作
Word表格怎么去掉不要的线?Word表格删除不要线的方法
![](https://img.aspxhome.com/file/2023/0/30820_0s.jpg)