From: Prashant on
Following is the program I am using to change the font color of cell when cellvalue is greater than -1000. I am using conditional formatting function of excel to do this. What should be the format of the code to do this?


Excel = actxserver('Excel.Application');
set(Excel,'Visible',0);
Workbook = invoke(Excel.Workbooks, 'open', [fpath filesep file ext]);
sheet = get(Excel.Worksheets, 'Item',sheetname);
invoke(sheet,'Activate');

ExAct = Excel.Activesheet;
ExActRange = get(ExAct,'Range',range);
ExActRange.Select;
xlExpression=1;
Excel.Selection.FormatConditions.Delete;
Excel.Selection.FormatConditions.Add(xlExpression, [>], ['-1000']);
Excel.Selection.FormatConditions.Item(1).Font.ColorIndex = 56;

This program gives me following error:
??? Invoke Error, Dispatch Exception: Parameter not optional.