|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
各位大神,有一批word表格,字体要设为宋体4号,段落行距为固定值25,运行宏代码无法实现,麻烦大神帮忙看下
Sub HHH()
Dim strFileName As String
Dim strPath As String
Dim wApp As Object
Dim wDoc As Object
strPath = ThisWorkbook.Path & "\"
strFileName = Dir(strPath & "*.doc")
Set wApp = CreateObject("Word.Application")
Do While strFileName <> ""
Set wDoc = wApp.Documents.Open(strPath & strFileName)
With wApp.Selection
.ParagraphFormat.LineSpacingRule = wdLineSpaceExactly
.ParagraphFormat.LineSpacing = 25
.WholeStory
.Font.Name = "宋体" '宋体
.Font.Color = black '字体颜色黑色
.Font.Size = 14 '字体大小
End With
wDoc.Save
wDoc.Close
strFileName = Dir
Loop
Set wDoc = Nothing
wApp.Quit
Set wApp = Nothing
End Sub
|
|