Option Strict Off
‘Early binding would require COM reference to Excel which brings in
‘ Microsoft.Office.Core
‘ Microsoft.Office.Interop.Excel
‘Imports Microsoft.Office.Interop
‘However late binding requires Option Strict Off
Public Class cls
Try
‘Dim xlApp As Excel.Application
Dim xlApp As Object = CreateObject("Excel.Application")
Dim xlBook As Object = xlApp.Workbooks.Add
Dim xlSheet As Object = xlBook.Worksheets(1)
xlSheet.Range("A1").Select()
xlSheet.Paste()
Call FormatExcelSheet(xlApp)
‘xlSheet.Cells(2, 2) = "This is column B row 2"
xlSheet.Application.Visible = True
If MyNewFileName <> "" Then
xlSheet.SaveAs(MyNewFileName)
‘ Optionally, you can call xlApp.Quit to close the workbook.
End If
Catch ex As Exception
If IsT1 Then
Throw New ApplicationException(ex.Message, ex)
End If
End Try
End Sub
End Class