Open "file.txt" in Excel and SaveAs "file.xls 
Author Message
 Open "file.txt" in Excel and SaveAs "file.xls

I open a text file in Excel, then I want to save it as a
file.xls. When I close my excel object, objXL.Quit, it
asks me if I want to save the changes. I don't know how to
avoid this. Here is what I'm doing:

strTextFile = "C:\CardList.txt"
Set objXL = WScript.CreateObject("Excel.Application")
Set objWorkBook = objXL.WorkBooks.Open(strTextFile, 2, 1,
1, 1)
objWorkBook.SaveAs("C:\CardList.xls")
objXl.Quit



Wed, 12 Oct 2005 00:43:26 GMT  
 Open "file.txt" in Excel and SaveAs "file.xls
When you use Application internal Methods,

the mode will not be the same as with 'simple'

wsh methods.

-------

You are close to stay with "Excel" or
transform yourself.


Quote:
> I open a text file in Excel, then I want to save it as a
> file.xls. When I close my excel object, objXL.Quit, it
> asks me if I want to save the changes. I don't know how to
> avoid this. Here is what I'm doing:

> strTextFile = "C:\CardList.txt"
> Set objXL = WScript.CreateObject("Excel.Application")
> Set objWorkBook = objXL.WorkBooks.Open(strTextFile, 2, 1,
> 1, 1)
> objWorkBook.SaveAs("C:\CardList.xls")
> objXl.Quit



Wed, 12 Oct 2005 15:10:21 GMT  
 Open "file.txt" in Excel and SaveAs "file.xls
Hi Brad,

You can use the DisplayAlerts property to control whether
prompting occurs.

You might find this URL helpful:
http://msdn.microsoft.com/library/en-
us/odc_vsto2003_ta/html/excelobj.asp?
frame=true#excelobj_link2

Cheers,
Gwynn

strTextFile = "C:\CardList.txt"
Set objXL = WScript.CreateObject("Excel.Application")
Set objWorkBook = objXL.WorkBooks.Open(strTextFile, 2, 1,
1, 1)
objXl.DisplayAlerts = False
objWorkBook.SaveAs("C:\CardList.xls")
objWorkBook.Close
objXl.DisplayAlerts = True
objXl.Quit



Wed, 12 Oct 2005 18:59:32 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. CreateObject("Excel","//server"), MsgBox output

2. WSH and "Open File" dialog box

3. execcommand("saveAs") and menu file "Save as..."

4. exeCommand("SaveAs")?

5. execCommand("SaveAs")??

6. Disabling "BACK"/"FORWARD" buttons

7. objFSO.CreateTextFile("textfile.txt")

8. Problem With "window.showmodaldialog("")"

9. Disabling "BACK"/"FORWARD" buttons

10. How to "export" all data from UserManager in txt or xls file?

11. replacing "to" to "2" internet txt msging

12. CreateObject("Excel.Sheet")

 

 
Powered by phpBB® Forum Software