I am using the following code in a COM based application:
excelApp.Cells.Item[2,13]:=EncodeDate(2003,12,8);
excelApp.Cells.Item[2,14]:=EncodeDate(2003,12,10);
excelApp.Cells.Item[2,15]:='=NetWorkDays(M2,N2)';
The first two lines simply insert these dates into cells M2 and N2.
The next line should return the Working days between these dates (in
cell O2).
The procedure executes without any error, but when I open the Excel
Workbook cell O2 contains #NAME?, althogh the formula bar shows the
correct formula. If I then select cell O2 and press ENTER I get the
correct value (3).
I have also tried the following with the same results:
excelApp.Cells.Item[2,15].Select;
excelApp.ActiveCell.Formula:='=NetWorkDays(M2,N2)';
Any suggestions would be appreciated.
Nirmal Singh
Bookmarks