MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.
using Excel = Microsoft.Office.Interop.Excel; using System.Reflection; ... Excel.Application xlApp = new Excel.Application(); xlApp.Visible = false; //http://support.microsoft.com/default.aspx?scid=kb;en-us;320369 workaround System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-US"); System.Threading.Thread.CurrentThread.CurrentCulture = ci; ... Excel._Workbook wb = (Excel._Workbook)(xlApp.Workbooks.Add(Missing.Value)); Excel._Worksheet ws = (Excel._Worksheet)wb.Sheets.Add(Missing.Value, Missing.Value, Missing.Value, Missing.Value); ... Excel.Range formularRange = ws.get_Range("D2","D2"); //working code: formularRange.Formula = "=C2/B2"; //code throwing exception formularRange.Formula = "=IF(B2=0;0;C2/B2)";