Sheets(“hidesheet”).Visible = True is not working. I’m doing opening the excel etc inside of the invoke code. This code error is => Sheets is and interface type and cannot be used as an expression.
Dim xlApp As Microsoft.Office.Interop.Excel.Application
Dim xlWorkbook As Microsoft.Office.Interop.Excel.Workbook
Dim xlWorksheet As Microsoft.Office.Interop.Excel.Worksheet
xlApp = New Microsoft.Office.Interop.Excel.ApplicationClass
Try
xlWorkbook = xlApp.Workbooks.Open("Your excel path")
xlWorksheet = CType(xlWorkbook.Worksheets("Your sheet name"),Microsoft.Office.Interop.Excel.Worksheet)
xlWorksheet.Visible = Microsoft.Office.Interop.Excel.XlSheetVisibility.xlSheetHidden
xlApp.Visible = False
xlWorkbook.Save
xlWorkbook.Close
Catch ex As Exception
Throw ex
Finally
xlApp.Quit
End Try