I am new to vba, not sure how to create codes or functions and how to execute them.
I am trying to create a macro or a function that will (at the click of a button in a form) export a query to excel with the file name and todays date.
I found this and created a module, but I don't know how to gwt it to work.
Dim MytPath, ExportFile as String
MyPath = "C:\MyFolder\"
ExportFile = Mypath & "export_" & Format(Date, "yyyy-mm-dd") & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "qryCombined_forexport", ExportFile
I changed the info for my file:
Dim MytPath, ExportFile as String
Mypath = "O:\dixon planning queries\reports\"
ExportFile = Mypath & "masterma" & Format(Date, "yyyy-mm-dd") & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "qryCombined_forexport", ExportFile
I am trying to create a macro or a function that will (at the click of a button in a form) export a query to excel with the file name and todays date.
I found this and created a module, but I don't know how to gwt it to work.
Dim MytPath, ExportFile as String
MyPath = "C:\MyFolder\"
ExportFile = Mypath & "export_" & Format(Date, "yyyy-mm-dd") & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "qryCombined_forexport", ExportFile
I changed the info for my file:
Dim MytPath, ExportFile as String
Mypath = "O:\dixon planning queries\reports\"
ExportFile = Mypath & "masterma" & Format(Date, "yyyy-mm-dd") & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "qryCombined_forexport", ExportFile