SELECT line_no,order_id,product_id,unit_price,quantity, 0 as myQuantity ; FROM (_samples+'data\orditems') ; INTO CURSOR crsSample lcXLS = Sys(5)+Curdir()+'myorders.xls' Copy To (lcXLS) Type Xls *** Constant Group: XlDVType #define xlValidateInputOnly 0 #define xlValidateWholeNumber 1 #define xlValidateDecimal 2 #define xlValidateList 3 #define xlValidateDate 4 #define xlValidateTime 5 #define xlValidateTextLength 6 #define xlValidateCustom 7 *** Constant Group: XlDVAlertStyle #define xlValidAlertStop 1 #define xlValidAlertWarning 2 #define xlValidAlertInformation 3 *** Constant Group: XlFormatConditionOperator #define xlBetween 1 #define xlNotBetween 2 #define xlEqual 3 #define xlNotEqual 4 #define xlGreater 5 #define xlLess 6 #define xlGreaterEqual 7 #define xlLessEqual 8 oExcel = Createobject('Excel.application') With oExcel .Workbooks.Open(m.lcXLS) .Visible = .T. With .ActiveWorkbook.ActiveSheet .UsedRange.Columns.Autofit * if would apply to whole column * With .Range('F:F').Validation With .UsedRange.Columns(6).Validation .Add(xlValidateWholeNumber, xlValidAlertStop, xlBetween ,0,6) .InputTitle = "Integers 0-6" .ErrorTitle = "Integers 0 to 6" .InputMessage = "Enter 0 - 6" .ErrorMessage = "You must enter a number from 0 to 6" ENDWITH .Range('F1').Validation.Delete() && remove validation from header .UsedRange.Locked = .F. .Range('A:D').Locked = .T. .Protect('mypassword') Endwith ENDWITHCetin