|
-
Sep 12th, 2002, 10:44 PM
#1
Thread Starter
Hyperactive Member
Populating Excel
Iam trying to populate an Excel sheet using the COM MS Excel Lib10.0 using the following code:
Excel.Application a = new Excel.Application();
Excel.Workbook wb = a.Open ("C:\book1.xls");
Excel.Worksheet ws = wb.Worksheets.Item (1);
ws. Cells [2, 1].value = "YOUR STRING VALUE";
ws. Cells[ 2, 2].value = "YOUR STRING VALUE";
I get errors in the underlined lines. Help me out?
-
Sep 13th, 2002, 12:04 PM
#2
Addicted Member
Last edited by MasterBlaster; Nov 21st, 2002 at 03:42 PM.
-
Sep 15th, 2002, 11:16 PM
#3
Thread Starter
Hyperactive Member
On Pressing F5
There were builder errors, continue?
The following or the errors for the underlined lines >>
1. For a.open: Excel.Application does not contain a definition for open.
2. For Item: Provider Indexer or event item not supported by the language.
3. For Cells: Object does not contain a definition for values.
When I modified the last lines, I dont get the last error(3)
ws.Cells[2, 1] = "YOUR STRING VALUE";
ws.Cells[2, 2] = "YOUR STRING VALUE";
-
Sep 17th, 2002, 12:55 AM
#4
Thread Starter
Hyperactive Member
This is the recent code:
Excel.Application a=new Excel.ApplicationClass();
Excel.Worksheet ws=new Excel.WorksheetClass();
Excel.WorkbookClass wb;
Excel.Application a=new Excel.ApplicationClass();
wb = (Excel.WorkbookClass)a.Workbooks._Open("C:\\book1.xls",true,true,"mm","","",true,true,".",true,false ,true,true);
ws = (Excel.Worksheet)wb.Worksheets[1];
ws.Cells[2, 1] = "Date";
ws.Cells[2, 2] = "Location";]
I have a run-time error only in the underlined line:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in vcexcel1.exe
Additional information: COM object with CLSID {00020819-0000-0000-C000-000000000046} is either not valid or not registered.
Any help?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|