Thanks Cetin,
My problem was trying to set the protect property (protect = .T.) rather than calling the protect function protect(mypassword)
Ken
>>Hi,
>>
>>I have successfully automated the process of creating physical inventory count sheets and a 'master' roll up worksheet in an Excel Work Book. I just need one more thing... How do I "protect" the work sheets so that the users can enter data in only the actual count column?
>>
>>I was able to "unlock" those cells but I cannot seem to "protect" the work sheets.
>>
>>Thanks,
>>
>>Ken
>
>
>Use orders
>lcXLS = Sys(5)+Curdir()+'orders.xls'
>Copy To (lcXLS) Type Xls
>lcLastColumn = Chr(Asc('A')-1+Fcount())
>
>oExcel = Createobject('Excel.application')
>With oExcel
> .Workbooks.Open(lcXLS)
> With .ActiveWorkbook.ActiveSheet
> .UsedRange.Locked = .T.
> .Range(lcLastColumn+':'+lcLastColumn).Locked = .F.
> .Protect('mypassword')
> Endwith
> .Visible = .T.
>Endwith
>
Cetin