This project has moved. For the latest updates, please go here.

AddDateTimeValidation crashes excel 2010, but works well on excel 2007

Mar 5, 2013 at 10:09 AM
Dear Team,

Currently, I am using EPplus I have a code that adds DateTime Validation to a cell. Below piece of code works well in Excel 2007, but it crashes Excel 2010:
var validation = _worksheet.DataValidations.AddDateTimeValidation(cellDateAddress);

 //Format date in mm/dd/yyyy
                    string numberFormat = "MM/DD/YYYY";
                    range.Style.Numberformat.Format = numberFormat;
                    validation.Formula.Value = DateTime.Now.Date;
                    validation.ShowErrorMessage = true;
                    validation.ErrorStyle = ExcelDataValidationWarningStyle.stop;
                    validation.Error = "Invalid date,Enter in mm-dd-yyyy!";
Any help on above is much appreciated.