Transfer spreadsheet question

fieldling

Registered User.
Local time
Today, 15:20
Joined
Jul 6, 2007
Messages
36
I use the following code on a command button to save "Table1" as an excel spreadsheet called Table1.xls in a folder called export folder.
Code:
Private Sub Command14_Click()
stDocName = "Table1"
 DoCmd.TransferSpreadsheet [acExport], , stDocName, _
 "C:\Export Folder\Table1.xls", 0
 
End Sub

This works fine but I would like to save the spreadsheet like this: "Current Date"Table1.xls
So if I did it today it would look something like this "280808Table1.xls"

Any ideas how I can do this?
Thanks
 
I use the following code on a command button to save "Table1" as an excel spreadsheet called Table1.xls in a folder called export folder.
Code:
Private Sub Command14_Click()
stDocName = "Table1"
 DoCmd.TransferSpreadsheet [acExport], , stDocName, _
 "C:\Export Folder\Table1.xls", 0
 
End Sub

This works fine but I would like to save the spreadsheet like this: "Current Date"Table1.xls
So if I did it today it would look something like this "280808Table1.xls"

Any ideas how I can do this?
Thanks

Something like this should work I think.

Code:
stDocName = "Table1"
 DoCmd.TransferSpreadsheet [acExport], , stDocName, _
 "C:\Export Folder\" & Format(Date, "ddmmyy") & "Table1.xls", 0
 
Try this:

Code:
Private Sub Command14_Click()

dim strFile as string
strFile = "C:\Export Folder\" & Format(Date, "ddmmyy") & "Table1.xls"

stDocName = "Table1"
 DoCmd.TransferSpreadsheet [acExport], , stDocName, _
 strFile, 0
 
End Sub

???
 

Users who are viewing this thread

Back
Top Bottom