I have created and populated an Excel workbook with 3 worksheets. Sheet1 contains data; Sheet2 and Sheet3 are empty. I massage the data in Sheet1 and enter the output into Sheet2. I would now like to delete Sheet1 and close and save the Excel file.

I am embarressed to say I can't figure out how to delete a worksheet from an Excel spreadsheet in VB6. Hope you can help me out!

Try this:

Sub DeleteSheets()
dim xl as new excel.application
dim wb as excel.workbook
set wb=xl.workbooks.open("c:\test.xls"
xl.application.displayalerts=false
If wb.worksheets.count > 1
wb.worksheets(1).delete
End If
xl.application.displayalerts=true
wb.save
wb.close
xl.quit
set wb=nothing
set xl=nothing
End Sub

While I would have bet good money I had tried your solution, I am delighted to say it worked. Thanks for your help!

No Problem. Anytime. You can contribute on my site too. here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.