View Single Post
 
Old 11-30-2017, 06:25 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
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 of
Default

Spaces are not barred in filenames and the code you posted (essentially as below) works without any problem with your filename example

Code:
Sub Macro1()
Dim retval As Object
Dim strName As String
    On Error Resume Next
    strName = Replace(ActiveDocument.FullName, ".docx", ".txt")
    ActiveDocument.SaveAs2 FileName:=strName, FileFormat:=wdFormatText
    ActiveDocument.Close 0
    retval = Shell("notepad.exe " & strName, 1)
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