FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour OLE XLS
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
OLE XLS
Posted: Fri Feb 19, 2010 10:12 AM

Hello,
When i protect a cell of a sheet and activate the protection, the cell is pretected but i can't change
the colors or size of other cells .

How to enable it ?

Thanks .

Here is the code :
oxls := TOleAuto():New("Excel.Application")
oxls:WorkBooks:Open("test.XLS")
oBook := oxls:Get( "ActiveWorkBook")
oSheet := oxls:Get( "ActiveSheet" )
oxls:Sheets("Actif"):select()
oxls:visible:=.T.

   oSheet := oxls:Get( "ActiveSheet" )
   oSheet:UnProtect("TEST")

   oSheet:Range("A1","IV600"):Locked:=.F.
      oSheet:Cells( 6, 2 ):Select()
      oSheet:Cells( 6, 2 ):Font:Size := 7
      oSheet:Cells( 6, 2 ):WrapText := .T.
      wtxtp:="Something to be protected "
      oSheet:Cells( 6, 2 ):Value:=wtxtp 
      oSheet:Cells( 6, 2 ):Locked := .T.  
      * 
      oSheet:Protect("TEST")  
      *

Continue the discussion