View Single Post
 
Old 11-25-2017, 09:42 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
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

Use instead:
Code:
Sub saveastxt()
Dim RetVal As Object
Dim strName As String
    On Error Resume Next
    ActiveDocument.Save
    If ActiveDocument.Path = "" Then
        MsgBox "Document not saved!"
        GoTo lbl_Exit
    End If
    strName = Replace(ActiveDocument.FullName, ".docx", ".txt")
    ActiveDocument.SaveAs2 FileName:=strName, FileFormat:=wdFormatText
    ActiveDocument.Close 0
    RetVal = Shell("notepad.exe " & strName, 1)
lbl_Exit:
    Exit Sub
End Sub
__________________
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