M
Mike in Santa Rosa
I'm trying to get a simple c# app built that can launch/manipulate an excel
workbook, sheet. I've chased down several examples and can't any of them to
work. So I must be doing somethnig obviouslt wrong.
Most examples to get things started include something:
using Microsoft.Office.Interop.Excel;
or
using Excel;
or
using Excel = Microsoft.Office.Interop.Excel;
....along with the standard namespaces supplied by visual studio IDE, like
System & System.Drawing, etc.
The examples also say to add a refererence (COM) to my project for microsoft
Excel object lib 9, 10, 11, etc via the Project Add Reference menu pick.
I start with a blank C# windows application project and add my (COM) excel
11 object lib reference(office 2003 installed on my desktop).
Here's what I observe during build for the 3 "using" scenarios:
1) when I build using the (using Microsoft.Office.Interop.Excel I get "The
type or namespace name 'Interop' does not exist in the class or namespace
'Microsoft.Office' (are you missing an assembly reference?)
2) when I build using the (using Excel I get "Application' is an ambiguous
reference". This refers to the
Applicaiton.Run in my main argument. I can only assume Application in
conflicting with Excel.Application but can't figure out how to straighten
this out.
3) when I build using the (using Excel = Microsoft.Office.Interop.Excel I
get a Namespace '' already contains a definition for 'Excel' and can't
continue.
Here's another thing. (with Excel 11 referenced in app)
If I use intellisense to show me the members of Microsoft, there's no
..Office.Interop, only Office.Core. So if I should be using anything in the
"using" section it looks like it should be "using Microsoft.Office.Core;"
What using statement should I be incorporating or what else do I need to do?
I feel that once my "includes" are correct I can do the rest of the excel
stuff.(famous last words)
Thanks for absolutely any response in advance?
Mike
workbook, sheet. I've chased down several examples and can't any of them to
work. So I must be doing somethnig obviouslt wrong.
Most examples to get things started include something:
using Microsoft.Office.Interop.Excel;
or
using Excel;
or
using Excel = Microsoft.Office.Interop.Excel;
....along with the standard namespaces supplied by visual studio IDE, like
System & System.Drawing, etc.
The examples also say to add a refererence (COM) to my project for microsoft
Excel object lib 9, 10, 11, etc via the Project Add Reference menu pick.
I start with a blank C# windows application project and add my (COM) excel
11 object lib reference(office 2003 installed on my desktop).
Here's what I observe during build for the 3 "using" scenarios:
1) when I build using the (using Microsoft.Office.Interop.Excel I get "The
type or namespace name 'Interop' does not exist in the class or namespace
'Microsoft.Office' (are you missing an assembly reference?)
2) when I build using the (using Excel I get "Application' is an ambiguous
reference". This refers to the
Applicaiton.Run in my main argument. I can only assume Application in
conflicting with Excel.Application but can't figure out how to straighten
this out.
3) when I build using the (using Excel = Microsoft.Office.Interop.Excel I
get a Namespace '' already contains a definition for 'Excel' and can't
continue.
Here's another thing. (with Excel 11 referenced in app)
If I use intellisense to show me the members of Microsoft, there's no
..Office.Interop, only Office.Core. So if I should be using anything in the
"using" section it looks like it should be "using Microsoft.Office.Core;"
What using statement should I be incorporating or what else do I need to do?
I feel that once my "includes" are correct I can do the rest of the excel
stuff.(famous last words)
Thanks for absolutely any response in advance?
Mike