PC Review


Reply
Thread Tools Rate Thread

Date as filename

 
 
PVANS
Guest
Posts: n/a
 
      22nd Jul 2009
Hi there,

I am trying to include a a date that is referenced in a cell in my workbooks
filename. The macro crashes each time because it says it cannot include" / "
in the filename.

I have tried to change the format of the cell, the macro still takes the
date as 22/07/09.

Please can someone suggest how i can take the date listed in the cell,
remove the "/" and include it in the filename?

Thanks for all the help that this forum has provided already, I really
appreciate it.

Regards,
PVANS
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      22nd Jul 2009
With the date in cell A1; try

strFile = Format(Range("A1"),"dd-mm-yyyy")

Then use this variable to SaveAs..

If this post helps click Yes
---------------
Jacob Skaria


"PVANS" wrote:

> Hi there,
>
> I am trying to include a a date that is referenced in a cell in my workbooks
> filename. The macro crashes each time because it says it cannot include" / "
> in the filename.
>
> I have tried to change the format of the cell, the macro still takes the
> date as 22/07/09.
>
> Please can someone suggest how i can take the date listed in the cell,
> remove the "/" and include it in the filename?
>
> Thanks for all the help that this forum has provided already, I really
> appreciate it.
>
> Regards,
> PVANS

 
Reply With Quote
 
Sam Wilson
Guest
Posts: n/a
 
      22nd Jul 2009
dim strDate as string
strDate = format(range("A1").value,"dd.mm.yyyy")

then use strDate in your filename

"PVANS" wrote:

> Hi there,
>
> I am trying to include a a date that is referenced in a cell in my workbooks
> filename. The macro crashes each time because it says it cannot include" / "
> in the filename.
>
> I have tried to change the format of the cell, the macro still takes the
> date as 22/07/09.
>
> Please can someone suggest how i can take the date listed in the cell,
> remove the "/" and include it in the filename?
>
> Thanks for all the help that this forum has provided already, I really
> appreciate it.
>
> Regards,
> PVANS

 
Reply With Quote
 
PVANS
Guest
Posts: n/a
 
      22nd Jul 2009
Sorry, just to clarify... I am running a macro that saves the workbook
automatically.

I am using the following code in the macro:

ActiveSheet.Copy
ActiveWorkbook.SaveAs "c:\temp\" & Range("H7")
"PVANS" wrote:

> Hi there,
>
> I am trying to include a a date that is referenced in a cell in my workbooks
> filename. The macro crashes each time because it says it cannot include" / "
> in the filename.
>
> I have tried to change the format of the cell, the macro still takes the
> date as 22/07/09.
>
> Please can someone suggest how i can take the date listed in the cell,
> remove the "/" and include it in the filename?
>
> Thanks for all the help that this forum has provided already, I really
> appreciate it.
>
> Regards,
> PVANS

 
Reply With Quote
 
PVANS
Guest
Posts: n/a
 
      22nd Jul 2009
To Sam and Jacob,

It works beautifully. Thank you so much

You guys really have been such a great help. Thank you!

Regards,

PVANS

"Jacob Skaria" wrote:

> With the date in cell A1; try
>
> strFile = Format(Range("A1"),"dd-mm-yyyy")
>
> Then use this variable to SaveAs..
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "PVANS" wrote:
>
> > Hi there,
> >
> > I am trying to include a a date that is referenced in a cell in my workbooks
> > filename. The macro crashes each time because it says it cannot include" / "
> > in the filename.
> >
> > I have tried to change the format of the cell, the macro still takes the
> > date as 22/07/09.
> >
> > Please can someone suggest how i can take the date listed in the cell,
> > remove the "/" and include it in the filename?
> >
> > Thanks for all the help that this forum has provided already, I really
> > appreciate it.
> >
> > Regards,
> > PVANS

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
set filename to <filename-date> on open bob engler Microsoft Excel Worksheet Functions 2 13th Jul 2006 05:11 AM
set excel <filename> to <filename-date> bob engler Microsoft Excel Programming 2 12th Jul 2006 08:22 AM
date to filename =?Utf-8?B?amlt?= Microsoft Access 0 24th Jan 2005 06:19 PM
Using Date Form Field data in Outputto Filename (a date to string chanbge needed)? Rob Oldfield Microsoft Access Form Coding 3 4th Jan 2005 08:06 AM
Using Date in Filename Phil Amey Microsoft Excel Misc 4 17th Sep 2003 10:42 PM


Features
 

Advertising
 

Newsgroups
 


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