DelphiFAQ Home Search:

Using Formula One ActiveX control - my Excel sheet forgets locked cells (protection)

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

Question:

I am using Formula One ActiveX control in Delphi 5. My application generates a complex workbook and locks certain cells. When I export my Excel workbook, the locked cells are forgotten. Protection is enabled, but all cells are unlocked.

Answer:

I had the same problem and found that the property EnableProtection does not work as expected.
The documentation says:

EnableProtection sets or returns whether protection is enabled for all selected sheets.

Syntax

F1Book1.EnableProtection [ = boolean ]


What I found is that the number of places where you temporarily disable the protection must match exactly the number of places where you enable it. The code below will not work if the code executes updateformulas(), as in that case it assigns twice := false and only once := true

function updateformulas();
begin
  f1book.EnableProtection := false;

  // do something with f1book
end;



begin
  f1book.EnableProtection := false;

  if (condition) then updateformulas;

  f1book.EnableProtection := true;
end;

Comments:

2007-01-02, 11:18:23
john111smith@gmail.com from Iran  
Hi,

I use Formula One ActiveX control in Delphi 5.
'Menu->Component->Import ActiveX Control' shows that C:\Windows\System32\VCF132.ocx is the related file.
Even while I include this file with Applicatin for production of install package, It is need to install Delphi5 on the target PC for true load and work of the application.
What file(s) must be included so the application can work without instalation of Delphi5 ?

Regrads,
j. smith
2007-01-02, 14:02:45
anonymous from United States  
Hi John Smith.
Your Formula One ActiveX control CDROM should contain a 'redistributable' folder or installer.
You need to ship this with it.
I am shipping these files:

.\redist32\oleaut32.dll
.\redist32\olepro32.dll
.\redist32\stdole2.tlb
.\vcf15.ocx

After copying these files, my install program registers the OCX. You can do this using the regsrvr command line tool.
2007-01-02, 17:42:12
anonymous from Iran  
Thanks,

I use default Formula One from ActiveX control tab of Delphi5 menu. I have no CDROM.
Is it a third-party component and the developed application is only run with Delphi5?

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: