Note that there are some explanatory texts on larger screens.

plurals
  1. POExcel 2007 VSTO plugin exception when setting Font.Color
    primarykey
    data
    text
    <p>I am working on an Excel 2007 VSTO plugin that is throwing COM exceptions on the client but not when debugging on my development machine. </p> <p>What the plugin does is capture Excel's Startup event, define a specialized style, then add an event handler to the SheetChange event. Anytime a value is changed in the sheet, the cell is set to the new style. All of this is to provide users a way to see the cells they've changed. Code is as follows:</p> <pre><code>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; } </code></pre> <p>When this runs in dev, it runs perfectly. However when it's run on a client machine, I get this exception detail once the VSTO plugin loads. The interesting part is it seems to fail on the first COM interaction, which happens to be setting a Style.Font.Color property.</p> <p>Here are the exception details:</p> <blockquote> <p>System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC</p> <p>Server stack trace:</p> <p>Exception rethrown at [0]:</p> <p>at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)</p> <p>at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)</p> <p>at Microsoft.Office.Interop.Excel.Font.set_Color(Object )</p> <p>at TriQuint.DemandPlanning.Workbook.ThisWorkbook.ThisWorkbook_Startup(Object sender, EventArgs e)</p> <p>at Microsoft.Office.Tools.Excel.Workbook.OnStartup()</p> <p>at TriQuint.DemandPlanning.Workbook.ThisWorkbook.FinishInitialization()</p> <p>at Microsoft.VisualStudio.Tools.Office.EntryPointComponentBase.Microsoft.VisualStudio.Tools.Applications.Runtime.IEntryPoint.FinishInitialization()</p> <p>at Microsoft.VisualStudio.Tools.Applications.AddInAdapter.ExecutePhase(ExecutionPhases executionPhases)</p> <p>at Microsoft.VisualStudio.Tools.Applications.AddInAdapter.CompleteInitialization()</p> <p>at Microsoft.VisualStudio.Tools.Office.Internal.OfficeAddInAdapterBase.ExecuteEntryPointsHelper()</p> </blockquote> <p>Has anyone ever seen anything like this? I've done quite a few validations, such as ensuring the proper versions of .NET, VSTO Interop, Excel 2007, etc etc.</p> <p>Thanks in advance for any advice! Jim</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload