Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Behaviour of Save as and Displayalerts

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




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Behaviour of Save as and Displayalerts

Hi Hari,
See the top of my Backup page, and you want to put the
date in the form yyyy-mm-dd or yyyy_mmdd something
that you can sort the directory on.
http://www.mvps.org/dmcritchie/excel/backup.htm

If the file might already exist and your intent is to overwrite it
the best thing to do is to delete the file and ignore the error
from deleting the file before creating the new backup file.
Then exception coding is hardly a concern. Your main concern
would probably be in creating the new file that the directory
you want to put it in already exists, once you have your directory
as indicated in the macro it should continue to work on and on.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Hari" wrote ...
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Behaviour of Save as and Displayalerts

Hi David,

Thanx a lot. The info u have on backup's is exhaustive.

Specially thanx to you for that great tip of writng file names in the format
yyyy-mm-dd or yyyy_mmdd which will be the right one for sorting. Its a
ver very neat method. Thanx again.I have already incorporated it in my code
and will follow this convention

I was just wondering , in excel under format cells, date, locale settings,
International (ISO) the settings they have is "yyyy-mm-dd" or "yyyymmdd" and
so on. Is that convention present from the sorting perspective or there are
other equally good reasons for ISO to adopt such a Format for date.

Regards,
Har
India


"David McRitchie" wrote in message
...
Hi Hari,
See the top of my Backup page, and you want to put the
date in the form yyyy-mm-dd or yyyy_mmdd something
that you can sort the directory on.
http://www.mvps.org/dmcritchie/excel/backup.htm

If the file might already exist and your intent is to overwrite it
the best thing to do is to delete the file and ignore the error
from deleting the file before creating the new backup file.
Then exception coding is hardly a concern. Your main concern
would probably be in creating the new file that the directory
you want to put it in already exists, once you have your directory
as indicated in the macro it should continue to work on and on.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Hari" wrote ...
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.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default Behaviour of Save as and Displayalerts

Hi Hari,
Dates within Excel are sorted on the serial number days from
a certain date (usually Dec 31, 1899) so it doesn't matter
how you format them. As far as I'm concerned the world
blew it by not changing over to ISO date format with 2000
for all documents.

I wish I could show all dates yyyy-mm-dd by default
(Regional dates) and enter them as mm/dd/yy but that
wouldn't make sense except to me. When I change my
format to yyyy-mm-dd I create the similar types of problems
that other country's have with our US date format. The
ISO format and order is ONLY going to make sense with
four digit years which is part of the specification along with
the use of hyphens and not slashes.

You can always show the format in whatever order you want,
but Excel takes it to mean that if the order matches your
regional format then you don't have a format but it is the
regional format and would change if given to someone else.

So if I make a point of showing the year with four digits the next
person will only see four digit years if that is what they use in their
own regional formats.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Hari" wrote in message ...
Hi David,

Thanx a lot. The info u have on backup's is exhaustive.

Specially thanx to you for that great tip of writng file names in the format
yyyy-mm-dd or yyyy_mmdd which will be the right one for sorting. Its a
ver very neat method. Thanx again.I have already incorporated it in my code
and will follow this convention

I was just wondering , in excel under format cells, date, locale settings,
International (ISO) the settings they have is "yyyy-mm-dd" or "yyyymmdd" and
so on. Is that convention present from the sorting perspective or there are
other equally good reasons for ISO to adopt such a Format for date.

Regards,
Har
India



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
Displayalerts and Screenupdating Hari[_3_] Excel Programming 4 June 12th 04 11:37 AM
Application.DisplayAlerts in IE scoobydeux Excel Programming 1 April 19th 04 01:28 AM
Can't Set DisplayAlerts to False Mark Driscol Excel Programming 0 April 7th 04 06:11 PM
Can't Set DisplayAlerts to False Mark Driscol Excel Programming 1 April 6th 04 10:45 PM
application.displayalerts Erin[_5_] Excel Programming 1 December 4th 03 03:49 PM


All times are GMT +1. The time now is 07:14 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"