Testing with Excel

B

Brett

I'm writing a software program using .NET framework 2.0 with Excel 2007
installed on my dell laptop machine. I'm developing with Visual Studio 2005
using C#.
I have a method the first creates an instance of the Excel application:
Microsoft.Office.Interop.Excel.Application excelApp = new
Microsoft.Office.Interop.Excel.Application();
i then test the excelApp object to see if it is null and if it's null then
that means that Excel doesn't exist on the machine that is hosting the
application i'm developing, right?
or will the application throw an exception because excel doesn't exist on
the machine? how can i test to see if Excel is installed on the machine
without the application breaking if it is not installed? i currently have
Microsoft.Office.Core and Microsoft.Office.Interop.Excel as references and i
am using System.Runtime.InteropServices in the class i am coding in. any
help would be mush appreciated.

brett
 
J

Jim Cone

brett,
I doubt if you will get an answer in this newsgroup.
This a newsgroup for general Excel questions of a non-programming nature.
However, even the public.excel.programming newsgroup centers largely
around VBA and VBScript with the occasional API call thrown in.
Unless some VBA code using Create Object and Set statements would
be of value, one of the Visual Studio newsgroups would be a better choice.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Brett" <[email protected]>
wrote in message
I'm writing a software program using .NET framework 2.0 with Excel 2007
installed on my dell laptop machine. I'm developing with Visual Studio 2005
using C#.
I have a method the first creates an instance of the Excel application:
Microsoft.Office.Interop.Excel.Application excelApp = new
Microsoft.Office.Interop.Excel.Application();
i then test the excelApp object to see if it is null and if it's null then
that means that Excel doesn't exist on the machine that is hosting the
application i'm developing, right?
or will the application throw an exception because excel doesn't exist on
the machine? how can i test to see if Excel is installed on the machine
without the application breaking if it is not installed? i currently have
Microsoft.Office.Core and Microsoft.Office.Interop.Excel as references and i
am using System.Runtime.InteropServices in the class i am coding in. any
help would be mush appreciated.

brett
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top