CLEAR CLOSE TABLES all CREATE TABLE yy (fldchar c(10), fnum n(3), fdt D null, ftm T) FOR ia=1 TO 10 insert into yy VALUES (; PADL(ia,10,"0"),; ia,; IIF(RECNO()%2=0,DATE()-ia,NULL),; DATETIME()-ia) ENDFOR COPY TO c:\yy.xls xls && get Excel files with NULLS DO case && choose the case that you like case .t. && replace one field at once FOR ia=1 TO FCOUNT() lccom="replace " IF TYPE("EVALUATE(field(ia))")="D" lccom=lccom + field(ia)+" with DATE() for ISNULL("+field(ia)+")" &lccom ENDIF ENDFOR CASE .F. && record by record SCAN FOR ia=1 TO FCOUNT() IF isnull(EVALUATE(field(ia))) AND TYPE("EVALUATE(field(ia))")="D" REPLACE (FIELD(ia)) WITH DATE() ENDIF ENDFOR ENDSCAN ENDCASE *END, no NULLS in the table, and there will be no nulls in Excel file RETURNNow let us work with Excel File assuming it has null values in the
oExcel= CREATEOBJECT("Excel.Application") WITH oExcel .Visible = .t. .WorkBooks.Open("c:\yy.xls") WITH .Activesheet FOR ia=1 TO .UsedRange.Rows.Count WITH .cells(ia,3) IF EMPTY(.value) OR ISNULL(.value) .value=DATE() ENDIF ENDWITH ENDFOR ENDWITH ENDWITH oExcel=NULL>Hi,