ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel - save file - specify path and name (https://www.excelbanter.com/excel-programming/394401-excel-save-file-specify-path-name.html)

[email protected]

excel - save file - specify path and name
 
something which I have looked hard for is to be able to change path
and file name where I can input the text manually.
So I tried for myself and here is what I came up with. If you find it
useful let me know.


Dim myPath As String
Dim myFilename As String
'point at the (UNC) path here.
myPath = InputBox("enter path here")
If Right(myPath, 1) < "\" Then
myPath = myPath & "\"
End If
myFilename = InputBox("enter filename here") & " your text here if
common ending .xls"
ActiveWorkbook.SaveAs Filename:=myPath & myFilename

Cheers
Mark


John Bundy

excel - save file - specify path and name
 
Thats good work, but something you might find helpful:
dlgAnswer = Application.Dialogs(xlDialogSaveAs).Show
opens the dialog to let you choose where to put it instead of typing all of
that stuff.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


" wrote:

something which I have looked hard for is to be able to change path
and file name where I can input the text manually.
So I tried for myself and here is what I came up with. If you find it
useful let me know.


Dim myPath As String
Dim myFilename As String
'point at the (UNC) path here.
myPath = InputBox("enter path here")
If Right(myPath, 1) < "\" Then
myPath = myPath & "\"
End If
myFilename = InputBox("enter filename here") & " your text here if
common ending .xls"
ActiveWorkbook.SaveAs Filename:=myPath & myFilename

Cheers
Mark



[email protected]

excel - save file - specify path and name
 
On 30 Jul, 16:22, John Bundy (remove) wrote:
Thats good work, but something you might find helpful:
dlgAnswer = Application.Dialogs(xlDialogSaveAs).Show
opens the dialog to let you choose where to put it instead of typing all of
that stuff.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.



" wrote:
something which I have looked hard for is to be able to change path
and file name where I can input the text manually.
So I tried for myself and here is what I came up with. If you find it
useful let me know.


Dim myPath As String
Dim myFilename As String
'point at the (UNC) path here.
myPath = InputBox("enter path here")
If Right(myPath, 1) < "\" Then
myPath = myPath & "\"
End If
myFilename = InputBox("enter filename here") & " your text here if
common ending .xls"
ActiveWorkbook.SaveAs Filename:=myPath & myFilename


Cheers
Mark- Hide quoted text -


- Show quoted text -


Hi John,

Thats cool, I had been looking for a way to invoke the box but couodnt
find it. Thanks for that.

Mark



All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com