I am working on an Excel 2007 VSTO plugin that throws COM exceptions on the client, but not when debugging on my development machine.
What the plugin does is to capture an Excel launch event, define a custom style, and then add an event handler to the SheetChange event. At any time, when the value changes on the sheet, the cell is set to a new style. All this is to give users the opportunity to see the cells that they have changed. The code is as follows:
private void ThisWorkbook_Startup(object sender, System.EventArgs e)
{
this.BeforeSave += new Microsoft.Office.Interop.Excel.WorkbookEvents_BeforeSaveEventHandler(ThisWorkbook_BeforeSave);
this.SheetChange += new Microsoft.Office.Interop.Excel.WorkbookEvents_SheetChangeEventHandler(ThisWorkbook_SheetChange);
cfStyle = Globals.ThisWorkbook.Styles.Add("CFStyle", missing);
cfStyle.Font.Color = Excel.XlRgbColor.rgbOrange;
cfStyle.Font.Bold = true;
cfStyle.Interior.Color = Excel.XlRgbColor.rgbLightGray;
cfStyle.Interior.TintAndShade = 0.8;
cfStyle.Borders.LineStyle = Excel.XlLineStyle.xlContinuous;
cfStyle.Borders.Weight = Excel.XlBorderWeight.xlThin;
cfStyle.Borders.Color = Excel.XlRgbColor.rgbDarkSlateGray;
cfStyle.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlDiagonalDown].LineStyle = Excel.XlLineStyle.xlLineStyleNone;
cfStyle.Borders[Microsoft.Office.Interop.Excel.XlBordersIndex.xlDiagonalUp].LineStyle = Excel.XlLineStyle.xlLineStyleNone;
}
dev, . , , , VSTO. , , COM-, , , Style.Font.Color.
:
System.Runtime.InteropServices.COMException(0x800A03EC): HRESULT: 0x800A03EC
:
, [0]:
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage( reqMsg, IMessage retMsg)
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData & msgData, Int32-)
Microsoft.Office.Interop.Excel.Font.set_Color ( )
TriQuint.DemandPlanning.Workbook.ThisWorkbook.ThisWorkbook_Startup ( , EventArgs e)
Microsoft.Office.Tools.Excel.Workbook.OnStartup()
TriQuint.DemandPlanning.Workbook.ThisWorkbook.FinishInitialization()
Microsoft.VisualStudio.Tools.Office.EntryPointComponentBase.Microsoft.VisualStudio.Tools.Applications.Runtime.IEntryPoint.FinishInitialization()
Microsoft.VisualStudio.Tools.Applications.AddInAdapter.ExecutePhase(ExecutionPhases executionPhases)
Microsoft.VisualStudio.Tools.Applications.AddInAdapter.CompleteInitialization()
Microsoft.VisualStudio.Tools.Office.Internal.OfficeAddInAdapterBase.ExecuteEntryPointsHelper()
- - ? , .NET, VSTO Interop, Excel 2007 ..
!