Delete sheet from excel

I want to delete an excel sheet from the file. And no, I don’t want to use the modern excel activity. Any vba code would work in my case.

hi @SunnyJha

please use the below code.

Application.DisplayAlerts = False


Application.DisplayAlerts = True

you can activate the workbook you want to delete the sheet or you can use thisworkbook specify the workbook name inside bracket.

or you can refer the below invoke VBA activity method.

  1. Inside the “Excel Application Scope,” add a “Invoke VBA” activity.
  2. In the properties of the “Invoke VBA” activity, write the following VB.NET code to delete the sheets:
    Sub DeleteSheets()
    Dim xlApp As Object
    Dim xlWorkBook As Object
    Dim xlWorkSheet As ObjectxlApp = CreateObject(“Excel.Application”)
    xlWorkBook = xlApp.Workbooks.Open(“path_to_your_excel_file.xlsx”)Try
    Catch ex As Exception
    ’ Handle any exceptions here if necessary
    End TryxlWorkBook.Save()
    End Sub

refer the below video for your reference.

hope it helps!!!

Hi @SunnyJha

Try this

File1.txt (192 Bytes)


1 Like


Please refer the below link:

Hi @SunnyJha

You can also use Balareva Excel activities, install this package

& use this activity

Hope this helps :slight_smile: