Exporting to Excel

E

eszanto

Hi,

I need to export data via a macro into a directory on a network. It is a
weekly report and I'd like to create a new folder (i.e. a folder with the
date of report run) and export the new report into this new folder each week.

Is there a way to do this in the macro?

Any hint would be appreciated.
Eva
 
P

Piet Linden

Hi,

I need to export data via a macro into a directory on a network. It is a
weekly report and I'd like to create a new folder (i.e. a folder with the
date of report run) and export the new report into this new folder each week.

Is there a way to do this in the macro?

Any hint would be appreciated.
Eva

Something like this should work...
Private Sub Command0_Click()
Dim strPath As String

'---Set up the folder name and location
strPath = CurrentProject.Path & "\Report " & Format(Date, "mm-dd-
yy")

'---Create the directory/folder
MkDir strPath

'---Export your files to the folder
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"qryWhatever", strPath, True

End Sub
 

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