BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do I protect?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Felix A. Hernandez
Guest





PostPosted: Sat Aug 05, 2006 7:24 pm    Post subject: How do I protect? Reply with quote



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





PostPosted: Sun Aug 06, 2006 4:59 am    Post subject: Re: How do I protect? Reply with quote



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





PostPosted: Mon Aug 07, 2006 7:06 pm    Post subject: Re: How do I protect? Reply with quote



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





PostPosted: Tue Aug 08, 2006 2:07 am    Post subject: Re: How do I protect? Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.