Solved

protect sheet with delphi

Posted on 2013-11-21
4
949 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 26

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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

777 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