0

I'm using the following script to convert an Excel file into a CSV tab delimited txt file.

xls = "C:\Ristken Data Load\Wade SPIFF log file"
csv = "c:\Ristken Data Load\Wade SPIFF log file"
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Open(xls)

oBook.Worksheets(2).Activate
oBook.Worksheets(2).Rows("1:4").Delete
oBook.SaveAs csv, -4158
oBook.Close True
oExcel.Quit

I'd like to add something to this script so that, it overwrites the txt file each time it runs without having the popup box asking if you want to overwrite the existing file.

fujiFX
  • 403
  • 8
  • 17
  • This looks to be a duplicate of [How to use workbook.saveas with automatic Overwrite](http://stackoverflow.com/questions/14634453/how-to-use-workbook-saveas-with-automatic-overwrite). Please review the answer to this question and if the same applies to yours. – fujiFX Feb 23 '15 at 22:48

1 Answers1

0

Easier then I thought it would be.

xls = "C:\Ristken Data Load\Wade SPIFF log file"
csv = "c:\Ristken Data Load\Wade SPIFF log file"
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Open(xls)
oBook.Application.DisplayAlerts = False

oBook.Worksheets(2).Activate
oBook.Worksheets(2).Rows("1:4").Delete
oBook.SaveAs csv, -4158
oBook.Close True
oExcel.Quit