Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a little code that saves the current file as a
user input name as soon as the file is opened. I am trying to figure out how to keep the code from breaking when the user chooses a filename that exists. The following code was suggested: fname = Application.InputBox( _ Prompt:="Please enter file name", Title:="File name", Type:=2) Do Until Dir(fname) = "" If fname = "False" Then Exit Sub 'user clicked Cancel fname = Application.InputBox(Prompt:="FileName Exists Please Try Again.", Title:="File Exists", Type:=2) Loop ThisWorkbook.SaveAs Filename:=fname I haven't been able to get this to work. I am not sure if I am doing something wrong or not. Any help with a solution is greatly appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
File Exists Formula | Excel Worksheet Functions | |||
Determine if a File Exists | Excel Discussion (Misc queries) | |||
File Exists | Excel Discussion (Misc queries) | |||
the file already exists - do you want to replace the existing file? | Excel Programming | |||
File|Close w/Save fires Workbook_Open twice | Excel Programming |