Elena M.
Elena M.

Reputation: 3

How to open an Excel Addin project from a Console Application project?

I have a Console Application project which opens a form. The same form has a button that should open an Excel file.

The solution is structured in 2 projects, the startup project is the console application and the other one is a Class Library that contains the Excel Addin and a Ribbon.

The thing is, I don't know how to start the excel when I press the button.

I added the reference of the Class Library to the References tab of my startup project.

Any help would be appreciated!

Upvotes: 0

Views: 28

Answers (1)

RustMan
RustMan

Reputation: 66

If the file has already been created:

FileInfo fi = new FileInfo("C:\\test\\report.xlsx");
if(fi.Exists)
{
    System.Diagnostics.Process.Start(@"C:\test\report.xlsx");
}
else
{
    //file doesn't exist
}

Upvotes: 1

Related Questions