FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Ole and Protection of a Excel sheet
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Ole and Protection of a Excel sheet
Posted: Wed Jun 17, 2009 11:51 AM

I use this command to talk to Excel
oxls := TOleAuto():New("Excel.Application")

I want to activate the protection of my sheet before saving it .

What is the syntax ?? How to pass a password as parameter ?

If should be something like :

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

Thanks

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Ole and Protection of a Excel sheet
Posted: Wed Jun 24, 2009 04:48 PM

Try this:

oExcel := TOleAuto():New( "Excel.Application" )
oSheet := oExcel:Get("ActiveSheet")

//To Protect
oSheet:Protect( cPassword )

//To remove protection
oSheet:Unprotect( cPassword )

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Re: Ole and Protection of a Excel sheet
Posted: Thu Jun 25, 2009 06:36 AM

Thanks for this info.
I have an other question :

How to disable the saving of a document . How to disable File Save or File Save As.

Thanks

Posts: 10
Joined: Tue Jun 28, 2011 08:26 PM
Re: Ole and Protection of a Excel sheet
Posted: Wed Mar 05, 2014 09:00 AM

Hi,

I need to use AutoFiltering property. Do you know how I can do it?
I'm using:

oHoja:Protection:AllowFiltering:=.t.
I also tried:
oHoja:Protec:AllowFiltering:=.t.

but it doesn't work. There is an argument error.

Thanks!

Continue the discussion