i have a excel template with 4 sheets
sheet1 & sheet4 are compulsary

but out of sheet 2 & sheet3 only one sheet shld be visible when exporting depending on the condition given in vb.net code

if the user checks sheet2 then sheet3 needs to be deleted & if the user check sheet3 on the user interface of the application then sheet2 shld be deleted

i hve written the code for the same

sheet3 gets deleted wuthout any issue but when tring to delete sheet2 i get error msg
----sheet2
ExcWS.Application.DisplayAlerts = False
ExcWS = ExcApp.Worksheets("OrderI")
ExcWS.Worksheets("Anexure-I").delete()
ExcWS.Application.DisplayAlerts = True



----sheet3
ExcWS.Application.DisplayAlerts = False
ExcWS = ExcApp.Worksheets("PurchaseI")
ExcWS.Worksheets("Anexure-I").delete()
ExcWS.Application.DisplayAlerts = True