LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Lock an Excel file

Solved!
Go to solution

Hi,

 

I already post some questions, this one is for the security of my program. Indeed, during my measurment, i save data in Excel. If someone close Excel I can't wanr people when a theshhold is reached.

 

My question is, is there a way to lock the Excel file during my measurment ?

Excel_Rpt or Excel ? (I found the Excel_WorkbkEventsRegOnBeforeClose but i don't know how to use it)

 

PS: Roberto, I count on you 😄 you helped me a lot ! (I accept help from anyone 🙂 )

 

Matthieu

0 Kudos
Message 1 of 4
(2,637 Views)

Hello Matthieu,

I'm sorry but I cannot help you in this matter: I normally don't rely on Excel for long-lasting tasks, I use if to read/write measurements and test results but when I need to store and operate on test data during program life I prefer to wite a different file without relying on a separate program. The problem you are facing (somebody closes Excle while you are using it) is just one of all those I can think of.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(2,615 Views)
Solution
Accepted by topic author MatGIL

Do you really need the Excel application to be open? If not, you may just want to set the visible property of the application to false (you can do this when you call ExcelRpt_ApplicationNew). I wouldn't consider that a security feature, but it would probably prevent people from instinctively closing the app when they aren't expecting it to popup.

 

As for Excel_WorkbkEventsRegOnBeforeClose - you should be able to figure out how to use it from the function help (right click anywhere in the function panel or parameters). I made an example some time ago that uses Excel_AppEventsRegOnSheetBeforeDoubleClick. It should be similar:

Registering an Excel Event as a Callback in LabWindows/CVI

 

Like Roberto mentioned - if you're just looking to save measurement data, there are more efficient ways than the Excel ActiveX API.

 

Hope this helps!

Trent

https://www.linkedin.com/in/trentweaver
Message 3 of 4
(2,603 Views)

Thank you and Roberto for answering,

 

I need Excel because I have to add an Antenna factor to change the unit (dBµV to dBµV/m). I search the Max and if a value is above a certain value, I warn people thanks to a song. I may use differents antennas so I have 4 Excel files for each one.

 

But i think I'll set the visible property. It's a good alternative.

 

Thank you guys !

 

Matthieu

0 Kudos
Message 4 of 4
(2,587 Views)