Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Joliette, Quebec, Canada
    Posts
    290
    Thanks
    9
    Thanked 0 Times in 0 Posts
    I have a macro that exports an access table to excel but I would like to an id number to the file name or todays date to the filename.

    Richard

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    I'd use VBA code, macros are hard to maintain. You can use an expression in the file name, for example:

    Dim strPath As String
    Dim strFile As String
    strPath = "C:\Export\"
    strFile = Format(Date, "yyyymmdd") & ".xls"
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "tblTest", strPath & strFileName, True

    Note: you can't use a date in the form 11/10/2009 in the file name, because slashes / aren't allowed in file names.


  3. #3
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Joliette, Quebec, Canada
    Posts
    290
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by HansV View Post
    I'd use VBA code, macros are hard to maintain. You can use an expression in the file name, for example:

    Dim strPath As String
    Dim strFile As String
    strPath = "C:\Export\"
    strFile = Format(Date, "yyyymmdd") & ".xls"
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "tblTest", strPath & strFileName, True

    Note: you can't use a date in the form 11/10/2009 in the file name, because slashes / aren't allowed in file names.
    thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •