Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Automation - Protect Worksheet
Message
From
16/11/2003 19:25:42
 
 
To
15/11/2003 08:47:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00850221
Message ID:
00850515
Views:
13
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()) && Last col not locked
>
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform