ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Message box to prompt for file name upon save (https://www.excelbanter.com/excel-programming/415259-message-box-prompt-file-name-upon-save.html)

Greg Snidow

Message box to prompt for file name upon save
 
Greetings everyone. I have, among other things, the following lines in a
macro to save a worksheet

ActiveWorkbook.SaveAs Filename:= _
"\\MyURL\DAILY_PRODUCTION\NEW\test.txt" _
, FileFormat:=xlText, CreateBackup:=False

This works great, except that I don't want the file to be called "test" in
production. I need to have a dialog box pop up to ask me what to enter as
the name

I tried
....NEW\" & MsgBox & ".txt"

but it does not work. Any ideas?



Mike H

Message box to prompt for file name upon save
 
Maybe this,

But note I include no error checking for illegal filenames which you may
want to consider

response = InputBox("enter filename")
If response < "" Then
ActiveWorkbook.SaveAs Filename:="\\MyURL\DAILY_PRODUCTION\NEW" & response &
".txt" _
, FileFormat:=xlText, CreateBackup:=False
End If


Mike
"Greg Snidow" wrote:

Greetings everyone. I have, among other things, the following lines in a
macro to save a worksheet

ActiveWorkbook.SaveAs Filename:= _
"\\MyURL\DAILY_PRODUCTION\NEW\test.txt" _
, FileFormat:=xlText, CreateBackup:=False

This works great, except that I don't want the file to be called "test" in
production. I need to have a dialog box pop up to ask me what to enter as
the name

I tried
...NEW\" & MsgBox & ".txt"

but it does not work. Any ideas?



Greg Snidow

Message box to prompt for file name upon save
 
Mike, that worked like a charm, thank you.

"Mike H" wrote:

Maybe this,

But note I include no error checking for illegal filenames which you may
want to consider

response = InputBox("enter filename")
If response < "" Then
ActiveWorkbook.SaveAs Filename:="\\MyURL\DAILY_PRODUCTION\NEW" & response &
".txt" _
, FileFormat:=xlText, CreateBackup:=False
End If


Mike
"Greg Snidow" wrote:

Greetings everyone. I have, among other things, the following lines in a
macro to save a worksheet

ActiveWorkbook.SaveAs Filename:= _
"\\MyURL\DAILY_PRODUCTION\NEW\test.txt" _
, FileFormat:=xlText, CreateBackup:=False

This works great, except that I don't want the file to be called "test" in
production. I need to have a dialog box pop up to ask me what to enter as
the name

I tried
...NEW\" & MsgBox & ".txt"

but it does not work. Any ideas?




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

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