Saving Date in File Name using TransferSpreadsheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to export using TansferSpreadsheet. I have tried adding =format
(date)) but i save the fiel with "=form(date))" in the file name. Can
someone tell me what I am doing wrong?
Thanks
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, _
"z- qmtblTeoco Control", "C:\Documents and Settings\rxchri3.AD\My Documents\
=format(Date()) &" _
& " TEOQRA" & [Forms]![choose report]![zcontrol] & ".xls", True
 
I am trying to export using TansferSpreadsheet. I have tried adding =format
(date)) but i save the fiel with "=form(date))" in the file name. Can
someone tell me what I am doing wrong?
Thanks
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, _
"z- qmtblTeoco Control", "C:\Documents and Settings\rxchri3.AD\My Documents\
=format(Date()) &" _
& " TEOQRA" & [Forms]![choose report]![zcontrol] & ".xls", True

Format date how?
No = sign in the path.
Generic example:

"C:\FolderName1\FolderName2\" & Format(Date,"mm-dd-yyyy") &
"NameOfFile.xls"


Using your names:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "z-
qmtblTeoco Control", "C:\Documents and Settings\rxchri3.AD\My
Documents\" & Format(Date, "mm-dd-yyyy") & " TEOQRA" & [Forms]![choose
report]![zcontrol] & ".xls"", True
 
Thank you Fredg..
I dont have one more question, i hope you might be able to help me with. Is
it possible to change the Worksheet name also when you save it a spreadsheet?
Thanks
Raj


fredg said:
I am trying to export using TansferSpreadsheet. I have tried adding =format
(date)) but i save the fiel with "=form(date))" in the file name. Can
someone tell me what I am doing wrong?
Thanks
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, _
"z- qmtblTeoco Control", "C:\Documents and Settings\rxchri3.AD\My Documents\
=format(Date()) &" _
& " TEOQRA" & [Forms]![choose report]![zcontrol] & ".xls", True

Format date how?
No = sign in the path.
Generic example:

"C:\FolderName1\FolderName2\" & Format(Date,"mm-dd-yyyy") &
"NameOfFile.xls"


Using your names:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "z-
qmtblTeoco Control", "C:\Documents and Settings\rxchri3.AD\My
Documents\" & Format(Date, "mm-dd-yyyy") & " TEOQRA" & [Forms]![choose
report]![zcontrol] & ".xls"", True
 
Back
Top