Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

protect sheet with delphi

Posted on 2013-11-21
4
Medium Priority
?
1,108 Views
Last Modified: 2013-11-21
Hi

I have a code to chenge some properties in Excel (using Delphi XE2). Now I can protect the Sheet with the code
ExcelApp.ActiveWorkBook.ActiveSheet.Protect('myPassword')

Open in new window

. What I Need to know: how can I control properties like "DrawingObjects:=True, Contents:=True, Scenarios:=True , AllowFiltering:=True" ... I think, the protect-method has more Parameters than the Password. But where can I find a description of this Parameters?

Thanks, Peter
0
Comment
Question by:formi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:livestuff
ID: 39665816
Hi Peter,

Sorry, I am not Familiar with ExcelApp, however, as with all object instances in delphi.....

When typing in the method, for example, the  ".Protect("   portion, stop and it should display the parameters it takes, and whether there are any overloaded methods you can use that have addiitional parameters.
0
 
LVL 28

Accepted Solution

by:
Sinisa Vuk earned 2000 total points
ID: 39665838
like this:
ExcelApp := CreateOleObject('Excel.Application');
...
ExcelApp.ActiveSheet.Protect(Password:='myPassword', DrawingObjects:=True, Contents:=True, Scenarios:=True);

Open in new window

0
 

Author Closing Comment

by:formi
ID: 39665861
Thanks, it works!
0
 
LVL 1

Expert Comment

by:livestuff
ID: 39665932
LOL!  Of course it did. I think you should have learned how to get the parameters yourself rather than someone providing the code outright to you - because that is how you learnfor future references

Glad You got an answer you were seeking
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a serious pitfall that can happen when deleting shapes using VBA.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question