export query to excel macro

B

bluezcruizer

Hi all.
I have a db that holds thousands of records. I have a query that pulls the
top 10 records using a begin date and end date as criteria. I want to export
the data to excel via a macro activated by the switchboard. I have created
the macro, and all works well, except I have one, for lack of a better word,
annoyance.

I have named a file to output to in the macro, and have setwarnings to "no".
I'm getting a dialog box asking is it ok to overwrite the existing file with
the new output. How do I set the macro to answer that as a "yes" every time
so that the macro runs smoothly without confusing the users?

Thank you all for your help!
bc
 
B

bluezcruizer

Thanks Chris. That's a good answer, but hardly practical, because the user
would have to do that manually each time before running the macro. If the
macro could be setup to delete the file first, on the other hand, that would
do it. However, I don't see the functionality in the Access Macro group to
delete a file outside of Access.

Any other ideas that may work?

Thanks.
bc
 
C

Chris Reveille

Here is some code you could run before you run the macro
Kill "c:\YourPath\YourFile.xls"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top