Question about "TransferSpreadsheet" action

  • Thread starter Thread starter Mary
  • Start date Start date
M

Mary

Would like to export data to an excel file by the TransferSpreadsheet action
and found that data are appended to the original excel file.

I wonder if any methods to replace the original file or delete the old file
before data transfer.

My interim solution is to ask user to delete the old file by himself before
running the macro.

Thanks a lot!
 
Using VBA code, you can delete the file before you run the
TransferSpreaddsheet action:

Kill "PathToFile\FileName.xls"
 
It may also be useful to put a check in to ensure that the file hasn't
already been deleted (or you would probably get an error):

If Dir("PathToFile\FileName.xls") = "" Then
Else
Kill "PathToFile\FileName.xls"
End If

Jon
 
thanks a lot! already added.

EeOr said:
It may also be useful to put a check in to ensure that the file hasn't
already been deleted (or you would probably get an error):

If Dir("PathToFile\FileName.xls") = "" Then
Else
Kill "PathToFile\FileName.xls"
End If

Jon
 

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

Back
Top