How to code Excel Protection on worksheet - AllowFormattingColumns

HenryW

New Member
Hi,

I am trying to protect an excel sheet but allowing columns to be formatted.

recording a macro in excel gets me:

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingColumns:=True

Doing various permutations to get the Progress code has failed me.

chWorkSheet:protect:AllowFormattingColumns=TRUE.

What is the correct format or can it not be done.

Thanks in advance.

Henry
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
Have you looked at the Excel object model with the COM object viewer (proobjvw.exe)? It gives you an ABL-centric view of the syntax, and may point you in the right direction.
 

mrobles

Member
Try this

chExcelApplication:ActiveSheet:protect(TRUE,TRUE,TRUE).

or this
/*ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFormattingColumns:=True */

chWorkSheet:protect(true, true, true, true)

1srt true = DrawingObjects
2nd true = Contents
3er true = Scenarios
4rd true = AllowFormattingColumns
 

HenryW

New Member
mrobles,

You hit the nail on the head.

The format is indeed:

chWorkSheet:protect(true, true, true, true)

except.... what each "true" stands for is not correct

chWorkSheet:protect("test1234", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE).

first one is password
sixth one is what I was looking for

Success.

I will try and narrow down what each one does and post here next week (good old trial and error method)

Thanks for the hint

Henry
 
Top