Step1 打开Word 2007+
->新建空白文档
->按Alt+F11进入VBA
Step2 在VBA左侧Prject空白处点右键
->插入
->模块, 如下图
在此模块中插入如下代码
'docx文件转doc文件
Sub doc2docx()
Dim myDialog As FileDialog
Dim oFile As Variant
Set myDialog = Application.FileDialog(msoFileDialogFilePicker)
With myDialog
'清除所有文件筛选器中的项目
.Filters.Clear
'增加筛选器的项目为所有WORD2007文件
.Filters.Add ".doc文件", "*.doc", 1
'允许多项选择
.AllowMultiSelect = True
'确定
If .Show = - 1 Then
'在所有选取项目中循环
For Each oFile In .SelectedItems
With Documents.Open(oFile)
.SaveAs FileName: = Replace(oFile, "doc", "docx"),FileFormat: = 12
.Close
End With
Next
End If
End With
End Sub
Step3点击运行按钮, 运行此VBA
->多选欲转换的.doc文件
->确定后将转换在同目录下, 为.docx文件, 如下图
参考文献:
https://jingyan.baidu.com/article/d5c4b52b1e57d99a560dc595.html