Date in Output Excel File Name (1 Viewer)

gmatriix

Registered User.
Local time
Today, 10:40
Joined
Mar 19, 2007
Messages
365
Hello All,

I am trying to put the date in the file name. I am outputting a table to an excel file and trying to put the date before the file name.

What i was working with so far......sorry relatively new to this
Code:
Function testthisone()
Dim FilTim As String
Dim FilNam As String
Dim OutNam As String

FilTim = Date
FilNam = "C:\Users\userc\Desktop\TestAutoqry\HelloTest.xls"


    DoCmd.OutputTo acOutputTable, "RTest MCR", "Excel97-Excel2003Workbook(*.xls)", FilNam, False, "", , acExportQualityPrint

End Function

Any Ideas?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 15:40
Joined
Feb 19, 2013
Messages
16,630
try

FilNam = "C:\Users\userc\Desktop\TestAutoqry\HelloTest " & format(date(),"yyyy-mm-dd") & ".xls"
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:40
Joined
May 7, 2009
Messages
19,247
Function testthisone()
Dim FilTim As String
Dim FilNam As String
Dim OutNam As String
Dim path as string
Dim ext as string


FilTim = Format(Date(), "\_yyyy-mm-dd")
FilNam = "HelloTest"
path="C:\Users\userc\Desktop\TestAutoqry"
ext=".xls"


DoCmd.OutputTo acOutputTable, "RTest MCR", "Excel97-Excel2003Workbook(*.xls)", path & FilNam & FilTim & ext, False, "", , acExportQualityPrint

End Function
 

gmatriix

Registered User.
Local time
Today, 10:40
Joined
Mar 19, 2007
Messages
365
Thanks alot guys....nice to awesome people willing to help!!
 

Users who are viewing this thread

Top Bottom