07-12-2012 09:25 AM
Hi
How do i check if an excel file is opened by someone else?
And how do i chaeck if i can write to the excel file?
07-13-2012
06:23 PM
- last edited on
11-19-2025
09:08 AM
by
Content Cleaner
Hello Shako,
To communicate between LabWindows/CVI and Excel you need to get familiar with ActiveX Automation.
You will need to create an ActiveX Automation Controller which will let you access the exposed Excel Server objects.
Within those you will be able to find the functions that you need.
07-16-2012 01:37 AM
I am quite fimiliar with the Excel ActiveX but i cant find out how to do what i mentioned in the previous post.
Some info:
After connecting to an excel app or creating new one and getting valid handles.
I open the excel file with the default attributes. And i get no Anomalies here regarding the workbook.
I tried the following but it does not return any useful results.
Excel_GetProperty (ExcelFileStruct.WorkBooksHandle, NULL, Excel_WorkbookWriteReserved, CAVT_BOOL, &Reserved);
Excel_GetProperty (ExcelFileStruct.WorkBooksHandle, NULL, Excel_WorkbookWriteReservedBy, CAVT_CSTRING, ReservedBy);
Reserved Variable if not initialised return a random value, if i initialise it, it returns the initialised value.
This is wether or not the same excel file is opened by another use or not.
The ReservedBy Variable is the same.
The Excel is on the company server if its opened by one user. All other users must be notified that this user has the excel file opened.
Has anyone done this before?
or something like this?
I think this is possible to do because normal excel shows a popup with this information?
07-16-2012 09:40 AM
@Shako wrote:
I am quite fimiliar with the Excel ActiveX but i cant find out how to do what i mentioned in the previous post.
Since you are quite familiar with ActiveX, then convert the following to what you need.
http://msdn.microsoft.com/en-us/library/system.io.file.getattributes%28v=vs.100%29.aspx
http://msdn.microsoft.com/en-us/library/system.io.fileattributes.aspx