Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Date as filename

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Date as filename

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default Date as filename

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Date as filename

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Date as filename

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
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
Date into filename noe I need time also santaviga Excel Programming 11 October 26th 06 03:51 PM
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM
set excel <filename to <filename-date bob engler Excel Programming 2 July 12th 06 08:22 AM
date in filename JCanyoneer Excel Programming 1 April 5th 05 12:08 AM
Filename with date and time Alan Excel Programming 2 October 5th 04 08:31 PM


All times are GMT +1. The time now is 03:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"