![]() |
#2
|
||||
|
||||
![]()
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 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
jc491 | Word VBA | 7 | 01-21-2022 11:04 AM |
![]() |
MikeW | Word | 4 | 02-08-2017 09:41 AM |
Vba code to save document as pdf using document property text and rename folder. | staicumihai | Word VBA | 1 | 12-21-2015 07:39 AM |
VBA save a NEW unsave document without prompting user for a file name | KSP | Word VBA | 5 | 09-02-2014 01:42 PM |
![]() |
jabberwocky12 | Word VBA | 2 | 10-22-2010 12:23 PM |