PC Review


Reply
Thread Tools Rate Thread

Add Date to export file Name

 
 
AJOLSON
Guest
Posts: n/a
 
      16th Apr 2010
I am exporting a query to excel file on our server, but I would like to add
whatever the current date as an extention to the Name of the file.
Example
Current export file name AA.xls
Would like it to be: aa_04/16/2010.xls

How would I code that?
Here is what I have
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "AA", _
"\\Bhihnbwfa01\groups\HR\Verification\Org_View\ AA.xls", , "AA"

 
Reply With Quote
 
 
 
 
Ken Snell
Guest
Posts: n/a
 
      17th Apr 2010
Here is an example of how to concatenate today's date into the filename. You
can use any format that you wish, so long as it doesn't contain any
characters that are forbidden for use in a filename.

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "AA", _
"\\Bhihnbwfa01\groups\HR\Verification\Org_View\ AA" & Format(Date(),
"dd-mmm-yyyy") & ".xls", , "AA"

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"AJOLSON" <(E-Mail Removed)> wrote in message
news:8216DE7E-5AF6-4BFC-AF09-(E-Mail Removed)...
>I am exporting a query to excel file on our server, but I would like to add
> whatever the current date as an extention to the Name of the file.
> Example
> Current export file name AA.xls
> Would like it to be: aa_04/16/2010.xls
>
> How would I code that?
> Here is what I have
> DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "AA", _
> "\\Bhihnbwfa01\groups\HR\Verification\Org_View\ AA.xls", , "AA"
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to export also the date of the emails to a file? Dan Microsoft Outlook Discussion 0 13th Aug 2008 05:02 PM
How do I export xml file and keep the date. Nicholas Microsoft Excel Misc 3 6th Mar 2008 07:02 PM
Export to File with Current Date =?Utf-8?B?U2FzaA==?= Microsoft Access VBA Modules 2 9th Oct 2007 05:10 PM
export query and add date to file name? =?Utf-8?B?R2Vvcmdl?= Microsoft Access External Data 3 24th Aug 2006 09:43 PM
Export a file with today's date Grek Microsoft Excel Programming 5 30th Apr 2004 11:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:33 PM.