Dear All
Even though I am a newbie of VBnet, I tried to open an Excel (Argument Name: in_File) and hide all sheets whose names do not contain “PIVOT” or “ERROR”. Invoke Code Activity displays “Option Strict On disallows late binding at line 7”. It would be greatly helpful if you could advise me what’s wrong with the codes below… Thanks in advance!
Dim excel As Microsoft.Office.Interop.Excel.Application = New Microsoft.Office.Interop.Excel.Application
Dim wb As Microsoft.Office.Interop.Excel.Workbook = excel.Workbooks.Open(in_File)
excel.Visible = False
For i As Integer = 1 To wb.Sheets.Count
Dim sh As Microsoft.Office.Interop.Excel.Worksheet = CType(wb.Sheets(i), Microsoft.Office.Interop.Excel.Worksheet)
If Instr(Ucase(sh.Name), "PIVOT") = 0 And Instr(Ucase(sh.Name), "ERROR") = 0 Then
sh.Application.Visible = Excel.XlSheetVisibility.xlSheetHidden
End If
Next
wb.Save
wb.Close
excel.Quit