View Single Post
 
Old 06-25-2021, 08:51 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If you don't want to retain the original doc file then
Code:
ActiveDocument.Convert
ActiveDocument.Save
If you want to keep the doc file
Code:
Dim oDoc As Document
Dim sName As String
    Set oDoc = ActiveDocument
    sName = ActiveDocument.FullName
    If oDoc.HasVBProject = True Then
        sName = Left(sName, InStrRev(sName, Chr(46))) & "docm"
        oDoc.SaveAs FileName:=sName, _
                    FileFormat:=wdFormatXMLDocumentMacroEnabled
    Else
        sName = Left(sName, InStrRev(sName, Chr(46))) & "docx"
        oDoc.SaveAs FileName:=sName, _
                    FileFormat:=wdFormatXMLDocument
    End If
    Set oDoc = Nothing
You might findDocument Batch Processes useful
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote