473,785 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating a chart in Excel from C# (Exception from HRESULT: 0x800A03EC)

2 New Member
Hello,
I am trying to create an Excel chart from C#. I am not a very experieced programmer, so my mistake could be very trivial. The code included is a very simple example. I just wanted to make sure the code runs first before I implement it into my application.
The code is supposed to plot for X values: column A in excel and for Y values: column B in Excel. The code up to the point and including exporting the data to excel runs properly. When I implement the code relating to plotting, I get a COMException; Exception from HRESULT: 0x800A03EC.

Expand|Select|Wrap|Line Numbers
  1.  
  2. ...
  3.  
  4. Range theRange6 = theWorkSheet.get_Range("A1", "B50");
  5. theRange6.Select();
  6. ChartObjects chartobjects = (ChartObjects)theWorkSheet.ChartObjects(Type.Missing);
  7. ChartObject chartobject = (ChartObject)chartobjects.Add(10 /*Left*/, 100 /*Top*/, 450 /*Width*/, 250 /*Height*/);
  8. _Chart chart = (_Chart)chartobject.Chart;
  9.  
  10. //chartobject.Chart.ChartWizard parameters are from MSDN help.
  11. chartobject.Chart.ChartWizard(theRange6, XlChartType.xlXYScatterSmooth, 1, XlRowCol.xlColumns, 0, 0, true, "Test", "x", "y", ""); 
  12.  
  13. theApplication.Visible = true;
  14.  
Could you please advise me on what I could be doing wrong? Any help would be greatly appreciated.
Thank you,
rGh
Jul 9 '07 #1
0 4927

Sign in to post your reply or Sign up for a free account.

Similar topics

0
6394
by: dd | last post by:
I am kind of puzzled with this problem. I am trying to open an xls file from C# and then save it as text or comma delimited. Here is the code: Excel.ApplicationClass oExcelApp = new Excel.ApplicationClass(); Object oMissing = System.Reflection.Missing.Value; Excel.Workbook oWB = oExcelApp.Workbooks.Open(sFileName, oMissing, oMissing,oMissing, oMissing,oMissing, oMissing, oMissing, oMissing,oMissing,oMissing, oMissing, oMissing); object...
0
4184
by: e-lores | last post by:
I need to print an excel doc to PDF. I'm doing next until now 1.- First I print the file to PostScript format using 'Acrobat Distiller' printer Dim wbook As Excel.Workbook wbook = appExcel.Workbooks.Open(fileExcel) wbook.PrintOut(fisrtPage, lastPage, , , "Acrobat Distiller", True, filePs) wbook.Close()
3
9925
by: | last post by:
I wrote a class in VB.NET to export the contents of a datagrid to Excel. It works perfectly on my machine, but it fails on my customers' PCs that have identical versions of Win XP (SP1) and Excel (SP1) installed. The error is: System.Runtime.InteropServices.COMException(0x800A03EC): Exception from HRESULT: 0x800A03EC. at Microsoft.Office.Interop.Excel._Worksheet.Paste(Object Destination, Object Link) at...
1
4391
by: Boomessh | last post by:
Hi, I am trying to open an existing excel workbook. It pops up an error stating that “Errors were detected in 1598.xls but Microsoft Office Excel was able to open the file by making the repairs listed below. Save the file to make these repairs permanent.” ‘Renamed invalid sheet name.’“ This message is popped up when the XLS file has work sheet with the name like rpt:coursedetails etc.,
2
36975
by: Sai | last post by:
Hi, I have written a small tool for our internal purpose in VB.net. This tool reads data from logs and saves it in an excel file. This tool is working fine with MS Office 2000 but raising the following exception, when i run the tool in a machine which contains MS Office 2003. Exception raised: "Exception from HRESULT: 0x800A03EC" Note: Added "Microsoft Excel 11.0 Object Library" in the project reference.
18
8291
by: Frank M. Walter | last post by:
Hello, I have made an small AddIn with udf for excel 2003. I use vs2003. The point of view is the function __T() I call it in excel sheet writing =__T() I am not able to set a value to a given cell. region.Value2="qwe"; //bumm! A exception will be trown. On all PCs with excel. HRESULT 0x800A03EC
5
9245
by: Mikil | last post by:
I am communicating with Excel Interop dll using c#. The get_Range function throws an exception if the parameters are invalid. For e.g. get_Range("Mikil", Type.Missing); will crash if the "Mikil" named range is not present. Why the does the function crash instead of returning "null"?
0
4509
by: tmg181 | last post by:
I currently upgraded a VB application to a VB.NET application with only a few modifications. One of the functions of the application is to create an Excel spreadsheet with the given values that were input on the users desktop. When i run the application on my end it works perfectly, but as soon as i install it on the users computer i cannot get the app to create/print the Excel file getting the error. (Exception from HRESULT: 0x800A03EC)... i...
0
3008
by: Anish G | last post by:
Hi All, I am getting the below given error while running my application in live server. In my local machine, its working fine. Please help me as it is very urgent for me. Exception from HRESULT: 0x800A03EC 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:...
0
10329
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10152
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.