|
本帖最后由 dogingate 于 2020-9-8 09:17 编辑
代码如下:
- Sub doc2docx() 'doc文件转docx文件
-
- Dim myDialog As FileDialog
- Set myDialog = Application.FileDialog(msoFileDialogFilePicker)
- Dim oFile As Object
- Dim oFilePath As Variant
-
- With myDialog
- .Filters.Clear '清除所有文件筛选器中的项目
- .Filters.Add "所有 WORD2007 文件", "*.doc", 1 '增加筛选器的项目为所有doc文件
- .AllowMultiSelect = True '允许多项选择
- If .Show = -1 Then '确定
- For Each oFilePath In .SelectedItems '在所有选取项目中循环
- Set oFile = Documents.Open(oFilePath)
- oFile.SaveAs FileName:=Replace(oFilePath, "doc", "docx"), FileFormat:=16
- oFile.Close
- Next
- End If
-
- End With
- End Sub
复制代码
|
|