Tuesday, February 15, 2011

Delete the Excel sheet

Dim objExcel

'Create an object for Excel Application
Set objExcel = WScript.CreateObject("Excel.Application")
Set temp = objExcel.Workbooks.Open("C:\Documents and Settings\deepakpe\Desktop\Mine_doc\temp.xlsx")

MsgBox temp.Worksheets.Count
MsgBox temp.Worksheets.Application
temp.Worksheets.Application.DisplayAlerts = false
temp.Worksheets.Delete
objExcel.Workbooks.Close ()
objExcel.Quit

'Release the object
Set objExcel = Nothing

No comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | JCpenney Printable Coupons