Export Access Query to Excel


/ Published in: Visual Basic
Save to your folder(s)

Runs and exports the already built query "qryRequestsTable" First command line works for xls, while second line can be used for xlsx. (ExportTimeStamp made up of predetermined strings)


Copy this code and paste it in your HTML
  1. UserName = UCase(Environ("Username"))
  2. ExportTimestamp = MonthRun & DayRun & Year(Now) & HourRun & MinuteRun
  3.  
  4. DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "qryRequestsTable", "C:\Documents and Settings\" & UserName & "\Desktop\RequestsTable" & ExportTimestamp & ".xls", True
  5.  
  6. DoCmd.TransferSpreadsheet acExport, , "qryRequestsTable", "C:\Documents and Settings\" & UserName & "\Desktop\RequestsTable" & ExportTimestamp & ".xlsx", True

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.