rcrecelius
Technical User
Forgive me, I dont know vbs, I searched and searched for what I have so far and feel like I am very close to a solution on this.
All files are in the same folder, currently on my laptop.
The task at hand is...
1.Take 3 xls files and convert them to txt
2.Combine the txt files into a single file - I've got a simple batch file handling this
3.Load the combined txt file into my ERP system(Epicor Vision) -
4.Then the cleanup part of this would be to delete the xls and txt files before the next time we run this process, which would likely be done on a weekly basis.
Mr Google led me to this solution for converting the xls to txt, which works great BUT, when I try to delete the txt files, I get the message that "The action cannot be completed because the file is open in Excel".
Or if I try to delete at command line I get "The process cannot access the file because it is being used by another process."
I think all I am missing is something to close Excel but I have searched for a while and have yet to find something that works with this.
My script...
Thanks in advance for all the your forthcoming brilliance!
All files are in the same folder, currently on my laptop.
The task at hand is...
1.Take 3 xls files and convert them to txt
2.Combine the txt files into a single file - I've got a simple batch file handling this
3.Load the combined txt file into my ERP system(Epicor Vision) -
4.Then the cleanup part of this would be to delete the xls and txt files before the next time we run this process, which would likely be done on a weekly basis.
Mr Google led me to this solution for converting the xls to txt, which works great BUT, when I try to delete the txt files, I get the message that "The action cannot be completed because the file is open in Excel".
Or if I try to delete at command line I get "The process cannot access the file because it is being used by another process."
I think all I am missing is something to close Excel but I have searched for a while and have yet to find something that works with this.
My script...
Code:
Set ExcelObject = CreateObject("Excel.Application")
ExcelObject.Visible = False
Set wb = ExcelObject.Workbooks.Open("C:\csv_combine\FUTURE_900_INCREASE_CODING.xls")
wb.SaveAs "C:\csv_combine\FUTURE 900 INCREASE CODING .txt", -4158
Set wb = ExcelObject.Workbooks.Open("C:\csv_combine\FUTURE_004_INCREASE_CODING.xls")
wb.SaveAs "C:\csv_combine\FUTURE 004 INCREASE CODING .txt", -4158
Set wb = ExcelObject.Workbooks.Open("C:\csv_combine\FUTURE_901_INCREASE_CODING.xls")
wb.SaveAs "C:\csv_combine\FUTURE 901 INCREASE CODING .txt", -4158
Thanks in advance for all the your forthcoming brilliance!