Saving Date in File Name using TransferSpreadsheet

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
 
F

fredg

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top