I have a simple VB.NET routing to open a text file into Excel and then save it as a Excel file (.xlsx). The open works file but saving fails with the NullReference Exception.
FileName = "C:\Temp\BOM of " & AssyName & ".txt"
Dim xlApp As New Excel.Application
Dim xlWorkBook As Excel.Workbook = Nothing
Dim xlWorkSheet As Excel.Worksheet
xlApp.Workbooks.OpenText(FileName, _
StartRow:=1, _
DataType:=Excel.XlTextParsingType.xlDelimited, _
TextQualifier:=Excel.XlTextQualifier.xlTextQualifierNone, _
Comma:=True)
xlApp.Visible = True
xlWorkBook.SaveAs("C:\Temp\BOM of " & AssyName & ".xlsx", Excel.XlFileFormat.xlWorkbookNormal)
xlWorkBook.Close(True)
xlApp.Quit()
Not sure what is going here. Image has failure message.