![]() |
Are there command line parameters for Excel?
I am looking for a way from a batch file to start excel to open a specific
xls file and then save it in tab delimited text format and then close the new ..txt file. I have a PERL script that requires the file to be in the .txt format in order to parse it. I have many files that require this operation and it would be easier to drive this process with this type of functionality. |
Are there command line parameters for Excel?
Yes Here is what I used.
excel /read c:\temp\book6.xls i found the answer a few months aggo att the microsoft webpage http://office.microsoft.com/en-us/ex...580301033.aspx "Michael" wrote: I am looking for a way from a batch file to start excel to open a specific xls file and then save it in tab delimited text format and then close the new .txt file. I have a PERL script that requires the file to be in the .txt format in order to parse it. I have many files that require this operation and it would be easier to drive this process with this type of functionality. |
Are there command line parameters for Excel?
Michael,
The example below is a vbScript that would open the xls file "C:\Test\RawTable.xls", save it as a csv file named "C:\Temp\RawTable.txt" and then convert the csv file to a tab delimited file with the same name, "C:\Temp\RawTable.txt" and finally close the txt file. _____________________ Const xlCSV = 6 Const xlDoNotSaveChanges = 2 Const ForReading = 1 Const ForWriting = 2 ' Open the Excel file and save a copy as a CSV file Set objExcel = CreateObject("Excel.Application") Set objWkbk = objExcel.Workbooks.Open("C:\Test\RawTable.xls") objExcel.DisplayAlerts = False objWkbk.SaveAs "C:\Temp\RawTable.txt", xlCSV objWkbk.Close xlDoNotSaveChanges objExcel.DisplayAlerts = True objExcel.Quit ' Open the CSV file and convert to a tab delimited file Set FSO = CreateObject("Scripting.FileSystemObject") Set objFile = FSO.OpenTextFile("C:\Temp\RawTable.txt", ForReading) strContents = objFile.ReadAll objFile.Close strContents = Replace(strContents, ",", vbTab) Set objFile = FSO.OpenTextFile("C:\Temp\RawTable.txt", ForWriting) objFile.Write StrContents objFile.Close ______________________ Steve Yandl "Michael" wrote in message ... I am looking for a way from a batch file to start excel to open a specific xls file and then save it in tab delimited text format and then close the new .txt file. I have a PERL script that requires the file to be in the .txt format in order to parse it. I have many files that require this operation and it would be easier to drive this process with this type of functionality. |
Are there command line parameters for Excel?
Wed, 1 Aug 2007 12:30:03 -0700 from Joel
: Yes Here is what I used. excel /read c:\temp\book6.xls i found the answer a few months aggo att the microsoft webpage http://office.microsoft.com/en-us/ex...580301033.aspx Unfortunately, arrogant Microsoft won't display that page because I'm using a real browser instead of Internet Explorer. There was something about checking to see whether I have Office 2007 -- itself pretty darn arrogant. -- "The Internet is famously powered by the twin engines of bitterness and contempt." -- Nathan Rabin, /The Onion/ Stan Brown, Oak Road Systems, Tompkins County, New York, USA http://OakRoadSystems.com/ |
Are there command line parameters for Excel?
Stan
You could always use Excel Help on "startup switches" Gord Dibben MS Excel MVP On Sat, 4 Aug 2007 20:51:32 -0400, Stan Brown wrote: Wed, 1 Aug 2007 12:30:03 -0700 from Joel : Yes Here is what I used. excel /read c:\temp\book6.xls i found the answer a few months aggo att the microsoft webpage http://office.microsoft.com/en-us/ex...580301033.aspx Unfortunately, arrogant Microsoft won't display that page because I'm using a real browser instead of Internet Explorer. There was something about checking to see whether I have Office 2007 -- itself pretty darn arrogant. |
Are there command line parameters for Excel?
"Stan Brown" wrote in message
t... Wed, 1 Aug 2007 12:30:03 -0700 from Joel : Yes Here is what I used. excel /read c:\temp\book6.xls i found the answer a few months aggo att the microsoft webpage http://office.microsoft.com/en-us/ex...580301033.aspx Unfortunately, arrogant Microsoft won't display that page because I'm using a real browser instead of Internet Explorer. There was something about checking to see whether I have Office 2007 -- itself pretty darn arrogant. I don't know which real browser you were using, but that page will display in Mozilla's Firefox. -- David Biddulph Rowing web pages at http://www.biddulph.org.uk/ |
Are there command line parameters for Excel?
Sat, 04 Aug 2007 19:13:35 -0700 from <Gord Dibben
<gorddibbATshawDOTca: You could always use Excel Help on "startup switches" Agreed, and in fact that's how I got the information when I was looking for it a few months ago. But I am just agog at the barriers Microsoft puts up to getting information from its Web site. There seems no good reason for it. -- "The Internet is famously powered by the twin engines of bitterness and contempt." -- Nathan Rabin, /The Onion/ Stan Brown, Oak Road Systems, Tompkins County, New York, USA http://OakRoadSystems.com/ |
Are there command line parameters for Excel?
Sun, 5 Aug 2007 09:11:42 +0100 from <"David Biddulph" <groups [at]
biddulph.org.uk: "Stan Brown" wrote in message t... Wed, 1 Aug 2007 12:30:03 -0700 from Joel : Yes Here is what I used. excel /read c:\temp\book6.xls i found the answer a few months aggo att the microsoft webpage http://office.microsoft.com/en-us/ex...580301033.aspx Unfortunately, arrogant Microsoft won't display that page because I'm using a real browser instead of Internet Explorer. There was something about checking to see whether I have Office 2007 -- itself pretty darn arrogant. I don't know which real browser you were using, but that page will display in Mozilla's Firefox. The real browser I'm using is Mozilla. As I mentioned, it just displayed a page saying Microsoft was checking whether I have Office 2007, and stuck there. -- "The Internet is famously powered by the twin engines of bitterness and contempt." -- Nathan Rabin, /The Onion/ Stan Brown, Oak Road Systems, Tompkins County, New York, USA http://OakRoadSystems.com/ |
Are there command line parameters for Excel?
In , Stan Brown
spake thusly: Sun, 5 Aug 2007 09:11:42 +0100 from <"David Biddulph" <groups [at] biddulph.org.uk: "Stan Brown" wrote in message t... http://office.microsoft.com/en-us/ex...580301033.aspx Unfortunately, arrogant Microsoft won't display that page because I'm using a real browser instead of Internet Explorer. There was something about checking to see whether I have Office 2007 -- itself pretty darn arrogant. I don't know which real browser you were using, but that page will display in Mozilla's Firefox. The real browser I'm using is Mozilla. As I mentioned, it just displayed a page saying Microsoft was checking whether I have Office 2007, and stuck there. I don't have Office 2007, do use Firefox, and had zero trouble looking at that page, even when i declined cookies. No problems at all. It's a useful page. Microsoft does lots one could criticize, but this seems not to be one of them. -- dman |
Are there command line parameters for Excel?
Sun, 5 Aug 2007 13:47:04 +0000 (UTC) from Dallman Ross
<dman@localhost.: I don't have Office 2007, do use Firefox, and had zero trouble looking at that page, even when i declined cookies. No problems at all. It's a useful page. Microsoft does lots one could criticize, but this seems not to be one of them. (shrugs) Well, I guess this is just an unsolved mystery. It's not the first time it has happened. If I were more motivated I'd dig into the headers and the page source and try to figure out what's going on. But since the chance Microsoft will heed my trouble report is pretty darn slim, it would be a waste of effort. -- "The Internet is famously powered by the twin engines of bitterness and contempt." -- Nathan Rabin, /The Onion/ Stan Brown, Oak Road Systems, Tompkins County, New York, USA http://OakRoadSystems.com/ |
All times are GMT +1. The time now is 02:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com