H
Hari
Hi,
I have a file by the name ABC format. I open this file and perform a couple
of operations through macros. At the end of the operation I want to save the
file by appending today's date in the format dd-mm-yy.
This saving operation is performed at the end of the code. I have pasted the
last lines of the code where the saving operation is being performed.
It is possible that the new name of the file by which I m saving already
exists. In my case I would simply want it to be overwritten and replaced
with the new copy of the file.
The problem is that if the file exists then a message is displayed saying
that do u want to replace the file, etc.
I understand that one might supress this message by adding
application.displayalerts = false before the "Active workbook.SaveAs"
statement and then again introduce a statement application.displayalerts =
true just after the "Active workbook.SaveAs" statement.
My query is whether by using displayalerts the previous file is overwritten
or not. I tried it by creating a file of the same name( ABC 10-Jun-04.xls)
with junk data and when I ran this macro the file I did have a new and
correct file.
The concern I have is when we have a file open and use the save as option
from file menu and save the file without changing the file name in the same
location then excel prompts whether we want to replace the existing file. In
that the option yes and no appears and by default "No" is active. Hence, the
question is if , No is active in this case and in the similar line when we
do application.displayalerts = false in the macro case doesnt excel take or
assume our default response to be "No" for replacing the file. How does
excel read our response to be yes in case of application.displayalerts =
false ?
ActiveWorkbook.SaveAs filename:= _
"C:\Documents and Settings\hprasadh\Desktop\Pil\Project comparison\ABC
format " & " " & CStr(Format(Now, "dd-mmm-yy")), FileFormat:=xlNormal
Regards,
Hari
India
I have a file by the name ABC format. I open this file and perform a couple
of operations through macros. At the end of the operation I want to save the
file by appending today's date in the format dd-mm-yy.
This saving operation is performed at the end of the code. I have pasted the
last lines of the code where the saving operation is being performed.
It is possible that the new name of the file by which I m saving already
exists. In my case I would simply want it to be overwritten and replaced
with the new copy of the file.
The problem is that if the file exists then a message is displayed saying
that do u want to replace the file, etc.
I understand that one might supress this message by adding
application.displayalerts = false before the "Active workbook.SaveAs"
statement and then again introduce a statement application.displayalerts =
true just after the "Active workbook.SaveAs" statement.
My query is whether by using displayalerts the previous file is overwritten
or not. I tried it by creating a file of the same name( ABC 10-Jun-04.xls)
with junk data and when I ran this macro the file I did have a new and
correct file.
The concern I have is when we have a file open and use the save as option
from file menu and save the file without changing the file name in the same
location then excel prompts whether we want to replace the existing file. In
that the option yes and no appears and by default "No" is active. Hence, the
question is if , No is active in this case and in the similar line when we
do application.displayalerts = false in the macro case doesnt excel take or
assume our default response to be "No" for replacing the file. How does
excel read our response to be yes in case of application.displayalerts =
false ?
ActiveWorkbook.SaveAs filename:= _
"C:\Documents and Settings\hprasadh\Desktop\Pil\Project comparison\ABC
format " & " " & CStr(Format(Now, "dd-mmm-yy")), FileFormat:=xlNormal
Regards,
Hari
India