| View previous topic :: View next topic |
| Author |
Message |
Felix A. Hernandez Guest
|
Posted: Sat Aug 05, 2006 7:24 pm Post subject: How do I protect? |
|
|
How do I protect the sheet and workbook in Delphi 7 using the
TExcelApplication VCL server?
I have the component on my form and I did the following code to unlock
the cells:
with Range['G3','G'+LineString] do
begin
Interior.Color := clYellow;
Locked := false;
end;
When I call the protect it does not work:
ActiveWorkbook.Protect('Banner', EmptyParam, EmptyParam);
What am I doing wrong? |
|
| Back to top |
|
 |
Oliver Townshend Guest
|
Posted: Sun Aug 06, 2006 4:59 am Post subject: Re: How do I protect? |
|
|
| Quote: | When I call the protect it does not work:
ActiveWorkbook.Protect('Banner', EmptyParam, EmptyParam);
|
You have to protect the Sheet, not the Workbook. And I think Protect has
one more argument.
Oliver Townshend |
|
| Back to top |
|
 |
Felix A. Hernandez Guest
|
Posted: Mon Aug 07, 2006 7:06 pm Post subject: Re: How do I protect? |
|
|
Oliver Townshend wrote:
| Quote: | When I call the protect it does not work:
ActiveWorkbook.Protect('Banner', EmptyParam, EmptyParam);
You have to protect the Sheet, not the Workbook. And I think Protect has
one more argument.
Oliver Townshend
I got the protection working using TExcelWorksheet VCL Server connecting |
to the TExcelApplication VCL Server. Here is the code:
try
ExcelWorksheet1.ConnectTo(ExcelApplication1.ActiveSheet as _Worksheet);
ExcelWorksheet1.Protect('password');
finally
ExcelWorksheet1.Disconnect;
end;
Thank you for your help.
Fair Bits...
Felix |
|
| Back to top |
|
 |
Oliver Townshend Guest
|
Posted: Tue Aug 08, 2006 2:07 am Post subject: Re: How do I protect? |
|
|
| Quote: | I got the protection working using TExcelWorksheet VCL Server connecting
to the TExcelApplication VCL Server. Here is the code:
try
ExcelWorksheet1.ConnectTo(ExcelApplication1.ActiveSheet as _Worksheet);
ExcelWorksheet1.Protect('password');
finally
ExcelWorksheet1.Disconnect;
end;
|
Try the following (simpler):
ExcelApplication1.ActiveSheet.Protect('password');
Oliver Townshend |
|
| Back to top |
|
 |
|