ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving date as part of filename (https://www.excelbanter.com/excel-programming/407286-saving-date-part-filename.html)

[email protected]

Saving date as part of filename
 
Hi all

I am using Excel 2000 and I want to assign a routine to a button that
takes a name from one cell and a date from another and passes this to
the Saveas routine. The idea is that I will end up with a copy of the
original file that has a name such as MyFile070308.xls.

However, when I try this the date gets re-formatted into the number of
days since 01/01/1900.

Any ideas?

Chris

[email protected]

Saving date as part of filename
 
Hi

If date is in A1 then try

Dim myDate as string
myDate = format(Datevalue(Range("A1")), "dd mmm yy")

you can change the "dd mmm yy" bit as required (look at date formats
in excel cell fomat options for syntax)
regards
Paul

On Mar 7, 9:56*am, wrote:
Hi all

I am using Excel 2000 and I want to assign a routine to a button that
takes a name from one cell and a date from another and passes this to
the Saveas routine. *The idea is that I will end up with a copy of the
original file that has a name such as MyFile070308.xls.

However, when I try this the date gets re-formatted into the number of
days since 01/01/1900.

Any ideas?

Chris



[email protected]

Saving date as part of filename
 
On 7 Mar, 10:11, wrote:
Hi

If date is in A1 then try

Dim myDate as string
myDate = format(Datevalue(Range("A1")), "dd mmm yy")

you can change the "dd mmm yy" bit as required (look at date formats
in excel cell fomat options for syntax)
regards
Paul

On Mar 7, 9:56 am, wrote:

Hi all


I am using Excel 2000 and I want to assign a routine to a button that
takes a name from one cell and a date from another and passes this to
the Saveas routine. The idea is that I will end up with a copy of the
original file that has a name such as MyFile070308.xls.


However, when I try this the date gets re-formatted into the number of
days since 01/01/1900.


Any ideas?


Chris


Thanks Paul


All times are GMT +1. The time now is 09:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com