ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Having a problem getting Excel to work from my .Net VB Program (https://www.excelbanter.com/excel-programming/313548-having-problem-getting-excel-work-my-net-vbulletin-program.html)

AustinTXMike

Having a problem getting Excel to work from my .Net VB Program
 
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


All times are GMT +1. The time now is 10:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com