I created a test MS Access database to export a table to Excel and a text file.
This works for Excel:
DoCmd.OutputTo acOutputQuery, "QryExportToExcel", _ acFormatXLS, XFile, False
I created a specification for a text file and used this code
DoCmd.TransferText acExportDelim, "Mytable Import Specification", "mytable", "D:\myfolder\test1.txt", False
In the error message, I get "test1 # txt" .
Microsoft Office Access database engine cannot find object
"Test1 # .txt". Make sure the object exists and that you write its name
and the way is right.

I tried to create test1.txt in the same way. To my surprise, this deleted the file that is already present.
Software: MS ACCESS 2007
source share