Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deleting the excel sheet before exiting the script
#1
I have to delete a excel sheet before exiting the script.
Please help me out!
Thanks
-Nagesh
Reply
#2
Hey I found this,
Code:
Public Sub DeleteAFile(filespec) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") On error resume next fso.DeleteFile(filespec) End Sub

This is working just fine for me.
Reply
#3
Hi,
What about the following script.
It creates an excel file with 5 sheets.
Then removes the second sheet.
You will find the mentioned sheet deleted from the workbook.

Let me know whether it works out for you or not!

Code:
Set xls=createobject("excel.application") Set xls1=xls.workbooks.add For i=0 to 4 xls1.worksheets.add next xls.worksheets(1).name="Browsers" 'xls.worksheets(2).delete xls1.saveas"E:\Child Object Properties2.xls" xls.save xls.quit Set xls=nothing Set xls1=nothing
Reply
#4
Hi..

This piece of code works fine. That is interesting.
Also i have posted another issue in the forum for changing the color of the cells in the datasheet. Please help me out with that too.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to create List box in excel sheet at Run time with values yes No JACKSPARROW 0 2,160 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
  Excel and Driver Script shipu 1 4,416 02-27-2014, 09:09 AM
Last Post: supputuri
  Custom sort -Excel Sheet kiran 1 4,456 01-28-2014, 09:23 AM
Last Post: supputuri
  Can we save an exported Excel sheet directly from QTP? Akhila 2 4,010 11-28-2013, 10:30 AM
Last Post: Akhila
  How to identify the object reference to the existing(already opened) Excel sheet yogeesh 1 10,594 09-26-2012, 07:00 PM
Last Post: krr

Forum Jump:


Users browsing this thread: 2 Guest(s)