請問word中多表格如何批量調整格式?
uj5u.com熱心網友回復:
首先,錄制宏,選擇一個表格,把你對單個表格做的事情都用錄下來。然后看生成的代碼。基本都是對selection物件的一系列操作。
就像下面這個一樣
Sub 宏4()
'
' 宏4 宏
'
'
Selection.MoveUp Unit:=wdLine, Count:=4, Extend:=wdExtend
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.Shading.Texture = wdTextureNone
Selection.Shading.ForegroundPatternColor = wdColorAutomatic
Selection.Shading.BackgroundPatternColor = -553582746
Selection.Font.Name = "黑體"
Selection.Tables(1).Style = "網格型淺色"
End Sub
接下來,寫自己的宏,總體的思路就是遍歷檔案中左右的表格,然后把每個表格選中,再重復對單個表格干的事情。
Sub test()
Dim t As Table
For Each t In Application.ActiveDocument.Tables '遍歷檔案中所有表格
t.Select '把表格選中
'TODO:把單個表格操作錄制的宏代碼貼上來即可
DoEvents
Next
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/30186.html
標籤:VB基礎類
上一篇:求教貼
下一篇:vb的識別像素點顏色
