Delphi IDE (239)
Windows with Delphi (38)
Visual Basic (3539)
New related comments
Number of comments in the last 48 hours
How to read/write ID3 tags in MP3 files
Read a text file backwards
Thread-safe and not threadsafe functions in Delphi
Read and write I/O ports
Using Formula One ActiveX control - my Excel sheet forgets locked cells (protection)
This 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.
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