I have several applications that communicate with Excel and Outlook vis COM. These applications work fine when running stand-alone. However, when debugging under VS2010, connecting to Excel will always start a new instance and I am unable to connect to Outlook at all.
My code to communicate with Outlook is as follows:
try { ol = (Microsoft.Office.Interop.Outlook.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Outlook.Application"); } catch { try { ol = new Microsoft.Office.Interop.Outlook.Application( ); } catch(System.Exception ex) { MessageBox.Show("Error starting Outlook - " + ex.Message, "Critical Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Under the debugger in VS2010, I always get a CO_E_SERVER_EXEC_FAILURE message.
I will add that I do not have administrative privleges on my development machine.
James M. Culpepper