使用方法:
- 点击开发工具---录制新宏(更改宏名)----点击停止录制;
- 点击宏,选择刚刚录制的宏名,点击编辑,即可在方法内用vb语言编辑代码,保存后关闭即可;
- 点击宏,选择刚刚录制的宏名,点击运行即可更新该word(按照代码的样式)。
*表格中字体垂直水平居中、颜色黑色、样式宋体
Sub Macro2()
{
For i=1 To ActiveDocument.Tables.Count
ActiveDocument.Tables(i).Select
With Selection
.Font.NameFarFast=”宋体”
.Font.NameAscii=”Times New Roman”
.Font.ColorIndex=1
.Cells.VerticalAlignment=wCellAlignVerticalCenter
.ParagraphFormat.Alignment=wAlignParagraphCenter
End With
ActiveDocument.Tables(i).AutoFitBehavior Behavior:=wdAutoFitWindow
Next i
End Sub
}
*修改文档中所有字体大小、样式、颜色
Sub Macro1()
ActiveDocument.Content.Font.Size=23
ActiveDocument.Content.Font.Name=”楷体”
ActiveDocument.Content.Font.ColorIndex=0
//ActiveDocument.Content.Font.Color=RGB(0,0,0)