美文网首页
20201027doc另存docx Hong code

20201027doc另存docx Hong code

作者: 小鱼儿spr | 来源:发表于2020-10-27 09:35 被阅读0次

Sub DocToDocx()

Dim xDlg As FileDialog
Dim xFolder As Variant
Dim xFileName As String
Application.ScreenUpdating = False
Set xDlg = Application.FileDialog(msoFileDialogFolderPicker)
If xDlg.Show <> -1 Then Exit Sub
xFolder = xDlg.SelectedItems(1) + "\"
xFileName = Dir(xFolder & "*.doc", vbNormal)
While xFileName <> ""
    Documents.Open FileName:=xFolder & xFileName, _
        ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
        PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
        WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
        wdOpenFormatAuto, XMLTransform:=""
    ActiveDocument.SaveAs xFolder & Replace(xFileName, "doc", "docx"), wdFormatDocumentDefault
    ActiveDocument.Close
    xFileName = Dir()
Wend
Application.ScreenUpdating = True

End Sub

相关文章

网友评论

      本文标题:20201027doc另存docx Hong code

      本文链接:https://www.haomeiwen.com/subject/zcmtvktx.html