Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Use MsgBox to get filename and save .xls file to pre-defined path

I would like to use a msgbox and ask a user to input a filename then,
when they hit ok, save the file as "C:\Folder1\Folder2\TheirInput.xls"

I would also like to test for no entry and alert then require entry
again if they don't put information in there.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 301
Default Use MsgBox to get filename and save .xls file to pre-defined path

You can't do that with a Msgbox; you need an Inputbox.

Retry:
Filename = Inputbox("Please enter the file name here")
if Filename<"" and Filename<"False" then
Activeworkbook.saveas "C:]FOlder1\Folder2\" & Filename & ".xls"
Else
goto Retry
Endif

"Bill Burlison" wrote in message
...
I would like to use a msgbox and ask a user to input a filename then,
when they hit ok, save the file as "C:\Folder1\Folder2\TheirInput.xls"

I would also like to test for no entry and alert then require entry
again if they don't put information in there.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Use MsgBox to get filename and save .xls file to pre-defined path

This snippet will ask the user to provide a file name, check if for validity
as a string, prevent them from entering a blank space and shut down the
procedure if they choose to cancel the process. You can work with it to suit
your purposes.

Do
fileName = Application.InputBox("ENTER A BRIEF TITLE FOR THE
NEW FILE." & Chr(10) & Chr(10) & "PLEASE RESTRICT TO NO MORE THAN TWO
WORDS.", "NEW FILE NAME", Type:=2)
fileName = StrConv(fileName, vbProperCase)
newFile = YourPath & fileName & ".xls"
If fileName = False Or fileName = "" Or fileName = " "
Then
Response = MsgBox("YOU MUST ENTER A FILE NAME FOR
THE OR CLICK CANCEL TO EXIT THE PROGRAM.", vbRetryCancel, "INVALID ENTRY")
End If
If Response = 2 Then
TitleScrn
Exit Sub
End If
Loop While Response = 4

"Bill Burlison" wrote:

I would like to use a msgbox and ask a user to input a filename then,
when they hit ok, save the file as "C:\Folder1\Folder2\TheirInput.xls"

I would also like to test for no entry and alert then require entry
again if they don't put information in there.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Use MsgBox to get filename and save .xls file to pre-defined p

Use this one. The other one had a reference to a procedure that you don't
need and would probably cause a runtime error.

Do
fileName = Application.InputBox("ENTER_ A BRIEF TITLE FOR THE_
NEW FILE." & Chr(10) & Chr(10) & "PLEASE_ RESTRICT TO NO MORE THAN TWO_
WORDS.", "NEW FILE NAME", Type:=2)
fileName = StrConv(fileName,_ vbProperCase)
newFile = YourPath & fileName & ".xls"
If fileName = False Or fileName = "" Or fileName = " "_
Then
Response = MsgBox("YOU MUST_ ENTER A FILE NAME
OR CLICK_ CANCEL TO EXIT THE PROGRAM.", vbRetryCancel,_ "INVALID
ENTRY")
End If
If Response = 2 Then
Exit Sub
End If
Loop While Response = 4


"JLGWhiz" wrote:

This snippet will ask the user to provide a file name, check if for validity
as a string, prevent them from entering a blank space and shut down the
procedure if they choose to cancel the process. You can work with it to suit
your purposes.

Do
fileName = Application.InputBox("ENTER A BRIEF TITLE FOR THE
NEW FILE." & Chr(10) & Chr(10) & "PLEASE RESTRICT TO NO MORE THAN TWO
WORDS.", "NEW FILE NAME", Type:=2)
fileName = StrConv(fileName, vbProperCase)
newFile = YourPath & fileName & ".xls"
If fileName = False Or fileName = "" Or fileName = " "
Then
Response = MsgBox("YOU MUST ENTER A FILE NAME FOR
THE OR CLICK CANCEL TO EXIT THE PROGRAM.", vbRetryCancel, "INVALID ENTRY")
End If
If Response = 2 Then
TitleScrn
Exit Sub
End If
Loop While Response = 4

"Bill Burlison" wrote:

I would like to use a msgbox and ask a user to input a filename then,
when they hit ok, save the file as "C:\Folder1\Folder2\TheirInput.xls"

I would also like to test for no entry and alert then require entry
again if they don't put information in there.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Use MsgBox to get filename and save .xls file to pre-defined path

Thanks you two. I have learned a bunch about msgbox in trying to do
this. Guess I can start on input boxes now. Your help will make the
start easier! Much asppreciated.

On Wed, 08 Nov 2006 11:58:05 -0800, Bill Burlison
wrote:

I would like to use a msgbox and ask a user to input a filename then,
when they hit ok, save the file as "C:\Folder1\Folder2\TheirInput.xls"

I would also like to test for no entry and alert then require entry
again if they don't put information in there.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo Max Loger Excel Discussion (Misc queries) 0 June 14th 11 04:30 PM
Macro to save file as different filename mac Excel Worksheet Functions 6 November 21st 07 10:43 PM
MsgBox for filename and static path BillB Excel Programming 2 November 8th 06 03:58 PM
Save file as filename plus fieldname annep[_2_] Excel Programming 1 December 18th 05 11:03 PM
Save filename as new file name C_Ascheman[_2_] Excel Programming 1 September 15th 05 01:05 AM


All times are GMT +1. The time now is 01:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"