Hi. I am trying to change the font, the font size and color of a cell in an excel worksheet from my vb.net application.
The first two lines of code run without errors but do not change anything in the cells. The third line, to change the color, gives me the following error at runtime: "System.Runtime.InteropSer
xception: 'Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))'"
The workbook is open to not read-only and is editable, in fact, the same cells will add values.
Here is my code:
'Format formula cell to match font and size of existing cells
ForcastWorkSheet.Cells.Range(strRange).Font.Name = "Arial"
ForcastWorkSheet.Cells.Range(strRange).Font.Size = "9"
ForcastWorkSheet.Cells.Range(strRange).Interior.Color = "Orange, Accent 2, Lighter 60%"