You can't use the built-in SaveAs dialog, read here. http://tinyurl.com/ywca5p
Something like this.
Sub Testing()
Dim MyFile$
MyFile$ = InputBox("Enter Filename without extension", "Save File")
If Len(MyFile$) > 1 Then
ActiveDocument.SaveAs MyFile$ & ".txt", wdFormatDOSText
Else
MsgBox "Save cancelled"
End If
End Sub
End Sub
Thanks David for the prompt answer.
Just a couple of comments.
What if I need to specify a new path?
I's there any way to open the note Pad from an office application?
I'm creating a word file from the content of a textbox in Excel, any chance
of doing it Note pad?
Thanks
> You can't use the built-in SaveAs dialog, read here. http://tinyurl.com/ywca5p
>
[quoted text clipped - 13 lines]
>
> End Sub
Steve Yandl - 02 Dec 2007 01:40 GMT
LuisE,
I think what I've got between the lines below might do what you want.
_____________________________________
Sub MyTextSave()
With Dialogs(wdDialogFileSaveAs)
.Format = wdFormatDOSText
.Name = ActiveDocument.Path & "\" & ActiveDocument.Name
If .Display Then
myFileName = WordBasic.FileNameInfo(.Name, 1)
End If
End With
If Len(myFileName) > 1 Then
If Not Right(myFileName, 4) = ".txt" Then
myFileName = myFileName & ".txt"
End If
ActiveDocument.SaveAs myFileName, wdFormatDOSText
ActiveDocument.Close wdSaveChanges
End If
If Application.Documents.Count < 1 Then
Application.Quit
End If
End Sub
________________________________________
You can certainly open Notepad.exe and load a specific text file from an
office application using Shell. You can also create a text file using the
Scripting.FileSystemObject object without involving Notepad. I doubt you
really want or need Notepad opened but perhaps you could explain a bit more
about what you want your users to input and what the final outcome should
be.
Steve Yandl
> Thanks David for the prompt answer.
>
[quoted text clipped - 26 lines]
>>
>> End Sub