954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem in Generating Excel Report

Hi All,

I am getting following error :

<strong>System.NullReferenceException: Object variable or With block variable not set.</strong>Source Error: 
Line 1266:              Error1.text=exp.tostring()
Line 1267:    
Line 1268:             oExcel.Quit()
Line 1269:             ReleaseComObject(oSheet)
Line 1270:    
Source File: F:\Web\airtel.net\newaudit\callwisereport.aspx    Line: 1268 


Stack Trace: 


[NullReferenceException: Object variable or With block variable not set.]
   Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn) +831
   Microsoft.VisualBasic.CompilerServices.LateBinding.LateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack) +23
   ASP.callwisereport_aspx.exportall_Click(Object sender, EventArgs e) in F:\Web\airtel.net\newaudit\callwisereport.aspx:1268
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1292

An early help would be appreciated
Thanks
Priya

pyari_priya1981
Newbie Poster
7 posts since Oct 2005
Reputation Points: 10
Solved Threads: 0
 

When I removed try and catch block, I got the following error :

Cannot create ActiveX component. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Exception: Cannot create ActiveX component.

Source Error: 


Line 219:          sheet=1
Line 220:          oExcel = Nothing
Line 221:          oExcel = CreateObject("Excel.Application")
Line 222:    
Line 223:            oBook = oExcel.Workbooks.Add
 

Source File: F:\Web\airtel.net\newaudit\callwisereport.aspx    Line: 221 

Stack Trace: 


[Exception: Cannot create ActiveX component.]
   Microsoft.VisualBasic.Interaction.CreateObject(String ProgId, String ServerName) +233
   ASP.callwisereport_aspx.exportall_Click(Object sender, EventArgs e) in F:\Web\airtel.net\newaudit\callwisereport.aspx:221
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1292


Please help me , I am a beginner in ASP.net and I have to resolve this problem today by all means.

Thanks
Priya


Priya

pyari_priya1981
Newbie Poster
7 posts since Oct 2005
Reputation Points: 10
Solved Threads: 0
 

Hi All, I have myself resolved the problem. Problem was with DCOM settings for COM applications. The settings are available at following link:
support.microsoft.com/support/kb/articles/Q183/6/07.ASP

Thanks

Priya

pyari_priya1981
Newbie Poster
7 posts since Oct 2005
Reputation Points: 10
Solved Threads: 0
 

when am trying to read the excel sheet, it says Cannot Create Active x control, i havesearched and tried to configure DCOM settings, even then am not able to get thru the problem solved, can any body help me out, am using Microsoft Office 2000 with Windows XP,

keyrun
Newbie Poster
1 post since Jul 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You