Solved

protect sheet with delphi

Posted on 2013-11-21
4
906 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
  • 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 25

Accepted Solution

by:
Sinisa Vuk earned 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now