ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Want to launch Excel from C# app (https://www.excelbanter.com/excel-programming/325715-want-launch-excel-c-app.html)

Stefani[_2_]

Want to launch Excel from C# app
 
For now, I simply want to launch Excel from a C# windows application. I've
found the MS Office Interop libraries with no documentation.

I'm expecting the following code to open the c:\temp.xls:

ApplicationClass excelApp = new ApplicationClass();
excelApp.Workbooks.Open("c:\\temp.xls",Type.Missin g,Type.Missing,Type.Missing,Type.Missing,Type.Miss ing,Type.Missing,Type.Missing,Type.Missing,Type.Mi ssing,Type.Missing,Type.Missing,Type.Missing,Type. Missing,Type.Missing);


What I'm getting is an EXCEL.EXE process started, but Excel never launches.

I'm trying to simply and quickly implement this as a part of a prototype app
where resulting data is displayed using Excel.

Any help would be appreciated.

Thanks.



Vyyk Drago[_2_]

Want to launch Excel from C# app
 
Stefani,

Add the following line of code:

excelApp.Visible=true;

Interop usually starts up Office applications invisibly, i.e. the process
for the application starts, but you have to make it visible programmatically.

Hope this helps.

Regards
Vyyk

"Stefani" wrote:

For now, I simply want to launch Excel from a C# windows application. I've
found the MS Office Interop libraries with no documentation.

I'm expecting the following code to open the c:\temp.xls:

ApplicationClass excelApp = new ApplicationClass();
excelApp.Workbooks.Open("c:\\temp.xls",Type.Missin g,Type.Missing,Type.Missing,Type.Missing,Type.Miss ing,Type.Missing,Type.Missing,Type.Missing,Type.Mi ssing,Type.Missing,Type.Missing,Type.Missing,Type. Missing,Type.Missing);


What I'm getting is an EXCEL.EXE process started, but Excel never launches.

I'm trying to simply and quickly implement this as a part of a prototype app
where resulting data is displayed using Excel.

Any help would be appreciated.

Thanks.




Stefani[_2_]

Want to launch Excel from C# app
 
Thank you. Thank you. :-)

Stefani


"Vyyk Drago" wrote in message
...
Stefani,

Add the following line of code:

excelApp.Visible=true;

Interop usually starts up Office applications invisibly, i.e. the process
for the application starts, but you have to make it visible
programmatically.

Hope this helps.

Regards
Vyyk

"Stefani" wrote:

For now, I simply want to launch Excel from a C# windows application.
I've
found the MS Office Interop libraries with no documentation.

I'm expecting the following code to open the c:\temp.xls:

ApplicationClass excelApp = new ApplicationClass();
excelApp.Workbooks.Open("c:\\temp.xls",Type.Missin g,Type.Missing,Type.Missing,Type.Missing,Type.Miss ing,Type.Missing,Type.Missing,Type.Missing,Type.Mi ssing,Type.Missing,Type.Missing,Type.Missing,Type. Missing,Type.Missing);


What I'm getting is an EXCEL.EXE process started, but Excel never
launches.

I'm trying to simply and quickly implement this as a part of a prototype
app
where resulting data is displayed using Excel.

Any help would be appreciated.

Thanks.







All times are GMT +1. The time now is 08:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com