I now hit an even bigger deadlock using the Excel.Application.Open() approach.
I don't think this approach is safe. Is there another way to launch a file
"David Thielen" wrote:
> Hi;
>
> I did the following for my code:
> Microsoft.Office.Interop.Excel.Application excelApp = new
> Microsoft.Office.Interop.Excel.ApplicationClass();
> excelApp.Visible = true;
> excelApp.Workbooks.Open(filename, 0, false, 5, "", "", false,
> Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "", true, false, 0,
> true, false, false);
>
>
> There are a couple of problems with this approach:
> 1) When running under Excel 2007 on my system, where Excel 2003 is also
> installed and is the default version of Excel, then it creates an instance of
> Excel 2003 instead of Excel 2007. How do I get it to use the same version of
> Excel I am running in.
>
> 2) When it pops up, it tells me "Calculation is incomplete. Recalculate
> before saving?" How can I avoid that message. And "No" is the only answer
> that works - "Yes" keeps bringing up the same prompt.
>
> 3) How do I know which extensions to do this for. A user could set all .txt
> files to be handled by Excel (weird, but possible). And they could set .XLS
> to be handled by OpenOffice.
>
> 4) I assume I need to do the same thing for Word? Same question (3) on what
> extensions. And what is the suggested code to do this for Word?
>
> --
> thanks - dave
> david_at_windward_dot_net
>
http://www.windwardreports.com >
> Cubicle Wars -
http://www.windwardreports.com/film.htm >
>
>
>
> "Jialiang Ge [MSFT]" wrote:
>
> > Hello Dave,
> >
> > When we are calling Prcess.Start("filename.xlsx") inside a Excel COM
> > Add-in, the current thread will ask the current process of Excel to open
> > the xlsx file. The current thread is waiting for the return of the
> > Process.Start call, Process.Start is also waiting for the finish of the
> > current thread actually. Therefore, a dead lock is constituted and it never
> > returns. To work-around it, we could use Excel.Application.Workbooks.Open
> > method to open the target xlsx. Please have a try and let me know the
> > result.
> >
> > If you have any concern or question, please feel free to let me know.
> >
> > Regards,
> > Jialiang Ge (jialge@online.microsoft.com, remove 'online.')
> > Microsoft Online Community Support
> >
> > =================================================
> > When responding to posts, please "Reply to Group" via your newsreader
> > so that others may learn and benefit from your issue.
> > =================================================
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >