Sharad Patel
Posts: 30
Joined: 2008-04-17
|
I have an add-in that uses some code to open a Word document. Normally this works well enough except if I try to open a non-Word document, Word shows me the convert dialog, if I cancel this dialog I get an error that is not being trapped by my try..catch block - here is the code
Word.Documents documents = app.Documents;
Word.Document document = null;
try
{
document = documents.Open(ref file, ref confirmConv, ref oReadOnly, ref addToMRU, ref a1, ref a2, ref a3, ref a4, ref a5, ref a6, ref a7, ref visible);
}
finally
{
if (document != null)
{
Marshal.ReleaseComObject(document);
}
if (documents != null)
{
Marshal.ReleaseComObject(documents);
}
}
Despite the try block, I still get the error window generated by Add-In Express - is there a way to trap this error?
Thanks. |
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi Sharad.
I don't see the 'catch' statement in your code. |
|