Exporting tables to Excel

G

Guest

I am trying to export an Access table to an excel spreadsheet with the date
appended on to the filename i.e. OutputTo excel with today's date on the end
of the filename, any ideas how I can do this?
 
G

Guest

Hi Susan,

Unfortunately it doesn't seem to work. I Have specified the following:

c:\"ScannerResults" & Format$(Date, "mm-dd-yy") &".xls" in the output file
section but I get an error message appearing saying "could not create". Am I
using incorrect syntax (Have tried a few combinations of this)?

Many thanks
 
S

SusanV

Your quotes are not right - you dropped the drive letter. Try:

"c:\ScannerResults" & Format$(Date, "mm-dd-yy") &".xls"

This is going to create a file in the root of c - if you meant for
ScannerResults to be a directory on C: then add a training backslash to the
hard-coded part:

"c:\ScannerResults\" & Format$(Date, "mm-dd-yy") &".xls"
 
S

SusanV

*trailing* not training LOL

SusanV said:
Your quotes are not right - you dropped the drive letter. Try:

"c:\ScannerResults" & Format$(Date, "mm-dd-yy") &".xls"

This is going to create a file in the root of c - if you meant for
ScannerResults to be a directory on C: then add a training backslash to
the hard-coded part:

"c:\ScannerResults\" & Format$(Date, "mm-dd-yy") &".xls"
 
G

Guest

I knew what you meant :)! Still get the same meesage though and no file being
created. it doesn't seem to like the "". Does this work for you? I am using
Access 2003.

Thanks,

Aist,
 
S

SusanV

Perhaps because this is in a macro... won't work for me that way either in a
macro - I use this in code all the time...
 
S

SusanV

The VB is simple:

DoCmd.OutputTo acTable, "TableName", acFormatXLS, "c:\ScannerResults\" &
Format$(Date, "mm-dd-yy") &".xls", -1
 
S

Steve Schapel

Forgot the = and will, I think, need to designate the Date as a function.

="C:\ScannerResults" & Format(Date(), "mm-dd-yy") &".xls"
 

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