Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Today's date as file name .csv in Xl 2007

What is the code to save a file as a csv which name is today's date? I'm
using Excel 2007.

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Today's date as file name .csv in Xl 2007

Hi LuisE

See
http://www.rondebruin.nl/saveas.htm

Use
FileExtStr = ".csv": FileFormatNum = 6


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"LuisE" wrote in message ...
What is the code to save a file as a csv which name is today's date? I'm
using Excel 2007.

Thanks in advance

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Today's date as file name .csv in Xl 2007

You didn't say what format you would want the date in (remembering, of
course, that you can't use slashes in a file name) nor whether you were
trying to save a single worksheet or the entire workbook. Assuming you
wanted to only save a single worksheet, you could use this code line to do
what you asked (note that the $ sign on the Date function call is required;
also, change the directory path from my example "d:\temp" to wherever you
actually want to save it at)....

Worksheets("Sheet1").SaveAs "d:\temp\" & Date$ & ".csv", xlCSV

Or you can make your own date format string using the Format function,
something like this...

Worksheets("Sheet1").SaveAs "d:\temp\" & Format(Date, _
"ddmmmyyyy") & ".csv", xlCSV

You may want to look up the SaveAs method in the help files as there are
additional options available.

--
Rick (MVP - Excel)


"LuisE" wrote in message
...
What is the code to save a file as a csv which name is today's date? I'm
using Excel 2007.

Thanks in advance


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 in Cell to change colors if the date is beyond today's date Pete Elbert Excel Discussion (Misc queries) 2 June 6th 09 06:31 AM
Reading File Name in VB Macro that contains today's date dhstein Excel Discussion (Misc queries) 10 November 13th 08 02:48 AM
Save As file name + Today's Date using a macro roryt Excel Programming 5 October 11th 06 04:14 PM
Open file saved as today's date Lift Off[_8_] Excel Programming 11 May 14th 04 02:05 PM
Export a file with today's date Grek Excel Programming 5 April 30th 04 11:24 AM


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