首页 > 其他分享 >word2010中统一调整表格格式

word2010中统一调整表格格式

时间:2023-01-10 11:37:38浏览次数:38  
标签:文档 wdEditorEveryone 表格 tempTable word2010 ActiveDocument 选中 格式


word中统一调整表格格式基本思路是:



1、选中所有的表格。



2、再对表格格式调整。



选中所有表格需要用到宏,操作很简单,具体操作如下:



(1)工具栏“视图”下右下角“宏”。




word2010中统一调整表格格式_excel


(2)点击,会出现下面的编辑框。



word2010中统一调整表格格式_excel_02


(3)先填写宏名,可以叫“SelectAllTables”,单击创建,出弹出编辑框如下。



word2010中统一调整表格格式_js_03


(4)拷贝代码进去,放在“selectalltables宏”和“endsub”之间,代码如下:


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


(5)拷贝后是这样的。



word2010中统一调整表格格式_python_04


 (6)然后点击工具栏中的三角形,就是运行宏。



word2010中统一调整表格格式_java_05


 (7)此时,文档中的表格就全选中了,就像调整一个表格一样调整就好了。

标签:文档,wdEditorEveryone,表格,tempTable,word2010,ActiveDocument,选中,格式
From: https://blog.51cto.com/dreamboy/5999920

相关文章