Well, of course you cannot export to a file without knowing its name. But if you mean that you don't want to be prompted on-screen for a file name, of course you can put the filename into your code.
Create a new macro
Set the action to "OutputTo"
Set Object Type to the table or query you want to output
Set OutputFormat to Microsoft Excel (*.xls)
Set the aoutput file to the path & filename, eg: âC:\Temp\TableOfStuf.xlsâ (donât include the quote marks. Leave this blank to be prompted for the file name.)
Set Autostart to No.
When you run the macro, it will create your file...
If the file already exists, you will be asked if you want to overwrite it.
In
VB this would be:
Code:
DoCmd.OutputTo acTable, "Tbl_Qry", "MicrosoftExcel(*.xls)", "C:\Sheet.xls", False