Reputation: 1297
I'm trying to create new Office excel workbook application how can i change start-up of this application to start with windows form instead of opening excel.
Thanks
Upvotes: 1
Views: 299
Reputation: 73253
Create two projects under your solution, one a winforms (or whatever it is), the other excel workbook application.
Set Winforms application as your startup project.
Reference excel application project to your winforms project.
Open up Excel application from your code in winforms project when required. Like this or so:
using (Process excelProcess = new Process())
{
excelProcess.StartInfo.FileName = Assembly.GetAssembly(typeof(SomeClassInExcelApplicationProject)).Location;
excelProcess.Start();
}
If you want winforms to close upon starting excel application, add Application.Exit();
after starting excel application process
Upvotes: 3