![]() |
|
#2
|
||||
|
||||
|
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 |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Creating a macro from a non-saved Word doc that duplicates the current open document and saves it
|
mike0215 | Word VBA | 3 | 11-17-2017 01:40 PM |
Cannot open saved Word document
|
otherlunds | Word | 1 | 09-01-2014 05:41 AM |
Formula to open external file with specific program (like open with)
|
pemartins | Excel | 16 | 02-24-2014 11:39 PM |
Run-time error '1004': Document not saved. The document may be open...
|
doctor_who12 | Excel Programming | 1 | 01-22-2014 04:47 PM |
| Preventing word/excel from trying to open external template locations | Perhill | Office | 0 | 03-02-2011 04:44 AM |