Dear All
I have a code to delete excel sheets having a common Criteria in their Names Like T10, T12, T16 and so on
I want the code to delete these sheets, the code is working on VBA but it does not on vb.net ??
My Code is
g
So, What is wrong exactly?
Thanks, Regards
Moheb Labib
I have a code to delete excel sheets having a common Criteria in their Names Like T10, T12, T16 and so on
I want the code to delete these sheets, the code is working on VBA but it does not on vb.net ??
My Code is
g
Code:
Private Sub DeleteTSheets()
Dim xl As New Excel.Application
Dim wb As Excel.Workbook
Dim ws as Excel.Worksheet
wb = xl.Workbooks.Open("C:\Patches\Main_Final.xlsm")
For Each ws in wb.sheets
If InStr(1, wb.Sheets(i).Name, "T") Then
If len(ws.name)=3 then
ws.delete()
End If
End If
Next
End Sub
Thanks, Regards
Moheb Labib