This should be a simple question for those of you who do this all the time. I
have a web based report that I need to allow the user to export to Excel. I
followed all the instructions from Microsoft web based knowledge areas and
included the COM Excel 9.0 library. I issued the following code:
================================================== ==
Private xlapp as Excel.Applicaiton
Private xlsheet as Excel.Worksheet
....
xlapp = GetXLApp() '<== Error happens in this function
xlapp.Workbooks.Add()
The function GetXLApp is below:
Public Function GetXLApp() As Object
Try
GetXLApp = CreateObject("Excel.Application") ' <== Returns error
GetXLApp.Visible = True
Catch ex As Exception
lblStatus.Text = Trim(ex.ToString)
End Try
End Function
================================================== =
The error message is:
System.NullReferenceException: Object reference not set to an instance of an
object. at QueMgmtReport.Queue.Activity_Report() in
\\net-plan\wwwroot$\QueMgmtReport\Queue.aspx.
vb:line 158