Do While FileExists(Y)
Y = InputBox(Y & " does exist!" & Chr(10) & "Enter new filename!")
Loop
ActiveWorkbook.SaveAs Filename:=Y
Public Function FileExists(fname As String) As Boolean
FileExists = IIf(Dir(fname) < "", True, False)
End Function
Regards,
Stefi
ylchuah ezt *rta:
Hi,
I have this line of code (Y is a string)
ActiveWorkbook.SaveAs Filename:=Y
when there are a same file name "Y" exist in the same location,
but i don't want to overwrite the file,
what code that need to add,
in order to ask the user to enter another file name instead of
overwrite the file?
Regards
yl chuah :(
--
ylchuah
------------------------------------------------------------------------
ylchuah's Profile: http://www.excelforum.com/member.php...o&userid=25341
View this thread: http://www.excelforum.com/showthread...hreadid=400373