Access Macro Export

Hello,

I have a macro that exports a table to an Excel file.  The action in the macro is called ImportExportSpreadsheet.  Every time I run the macro, it just adds another worksheet to the file.  I want it to completely overwrite the file instead.  Is there a way to do this?

Thanks,
Joel
Genius123Asked:
Who is Participating?
 
OddyWriterMr.Commented:
OK.

Because it's network drive. I used to face it before.
It's better to export as new file by add date/time in your file name.

This is example.
img2.png
0
 
PatHartmanCommented:
Delete the file if it exits before running the TransferSpreadsheet.
0
 
OddyWriterMr.Commented:
Hi Joel,

In my testing, it's replaced current excel file. Could you show your macro.

img1.png
1
 
Genius123Author Commented:
Sure.  See below.

macro screen shot
0
 
Genius123Author Commented:
Thank you.  That's a clever solution!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.