Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default saving file name with the date

Hi,
I tried to check on previous post but could find relavent answer.
I wanna write a code as follows
Dim docn As Date

Dim fn
'docn = "abi"
'Sheet1.Range("d2").NumberFormat = "[$-409]d-mmm;@"

docn = Format(Date, "[$-409]d-mmm;@")

docn = Sheet1.Range("d2")

'fn = "C:\Documents and Settings\My Documents\" & docn
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Packard Bell\My Documents\" & docn &
".txt", FileFormat:= _
xlText, ReadOnlyRecommended:=False, CreateBackup:=False

but why that file cannot be saved like file name= 25 March
thanks for your help

--
Regards,
Baha
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default saving file name with the date

Try using the worksheetfunction TEXT

Like so

orderDate =
WorksheetFunction.Text(Worksheets("input").Range(" orderDate").Value,
"DD-MMM-YYYY")
orderFile = facHisDir & invoiceNumber & "_" & facHisReg & "_" & orderDate &
".xls"

Cheers

Edwin



"Baha" wrote in message
...
Hi,
I tried to check on previous post but could find relavent answer.
I wanna write a code as follows
Dim docn As Date

Dim fn
'docn = "abi"
'Sheet1.Range("d2").NumberFormat = "[$-409]d-mmm;@"

docn = Format(Date, "[$-409]d-mmm;@")

docn = Sheet1.Range("d2")

'fn = "C:\Documents and Settings\My Documents\" & docn
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Packard Bell\My Documents\" & docn &
".txt", FileFormat:= _
xlText, ReadOnlyRecommended:=False, CreateBackup:=False

but why that file cannot be saved like file name= 25 March
thanks for your help

--
Regards,
Baha



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
saving a file with a date pat67 Excel Worksheet Functions 3 October 8th 09 08:39 PM
Saving an excel file using a date Ed Davis Excel Worksheet Functions 5 April 7th 07 05:44 PM
Saving worksheet in new file with date AND cell value as file name michaelberrier Excel Discussion (Misc queries) 4 May 26th 06 08:05 PM
Saving file with date on it mehta_agm[_2_] Excel Programming 2 January 18th 06 06:35 AM
Saving file as a date Jamie Excel Programming 1 May 19th 05 12:15 PM


All times are GMT +1. The time now is 06:20 AM.

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"