Wednesday, May 14, 2014

Delete a sheet to the existing workbook

'Delete a sheet to the existing workbook
Option explicit
Dim oex, owb, owd

'goto excel sw
            Set oex=createobject("Excel.Application")
            oex.Visible=true

'goto workbook
            Set owb=oex.Workbooks.Open("F:\Book1.xls")

'goto worksheet
            Set owd=owb.Worksheets("Sheet5")
            owd.delete

'save excel
            owb.Save

'close Excel
            oex.Quit         

'Destroy objects
            Set owd=nothing
            Set owb=nothing
            Set oex=nothing




No comments:

Post a Comment