View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
isabelle isabelle is offline
external usenet poster
 
Posts: 587
Default Two digit dates and two digit days

hi John,

y = 2012
m = 1
d = 6
dt = Format(DateSerial(y, m, d), "yyyymmdd")
sFileName = "C:\Documents and Settings\g701942\My Documents\SupplierResource\" & dt & " Weekly Supp Res-Ind ContrList-full.xls"



--
isabelle



Le 2012-01-13 13:47, John Menken a écrit :
The code snip below saves information to disk. However on a date like
Jan 6, 2012 it saves the file name as "201216...." and I would like it
to be "20120106...." with a two digit month and a two digit day. Is it
possible to modify the code below so that it will do this? Thanks.


'Save the file
Range("A2").Select
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\g701942\My Documents\Supplier
Resource\"& Year(x)& Month(x)& Day(x)& " Weekly Supp Res-Ind Contr
List-full.xls" _
, FileFormat:=xlExcel8, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False