LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read Unsaved changes in Excel Workbook

Solved!
Go to solution

Hi All,

 

I am reading test ids from excel workbook and processing. I want to read the test id from excel workbook even if user is currently editing it and not saved it yet. Is there a way to achieve this? I tried using ActiveX nodes, but LabVIEW throws an error while trying to open an currently editing excel workbook. 

0 Kudos
Message 1 of 9
(1,736 Views)

Open it read only. It is located int he workbook property,

 

Evcel Read Only.png

Tim
GHSP
0 Kudos
Message 2 of 9
(1,694 Views)
Solution
Accepted by topic author AryaStark92

I've done this successfully many times.  The information you describe is not in the file, it is memory.  Use ActiveX to connect to the ActiveWorkbook and ActiveSheet.  You can keep a copy of the entire sheet if you are looking for changes.

 

Beware: If the user places the cursor in the edit box or the cell, then all ActiveX commands will fail.  I solved this problem by use a macro in Word to send an Escape to Excel.

Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 3 of 9
(1,675 Views)

Hello Munroe,

 

Thanks for the reply, I have done exactly this. I have updated the code in the attachments. I am looking for my workbook in the opened workbooks, if its not opened, then opening it. However, I am not getting " You can keep a copy of the entire sheet if you are looking for changes." Can you please point me to this property or method?

 

0 Kudos
Message 4 of 9
(1,656 Views)

Hello aeastet,

 

Thank you for the reply. I have created a VI adding few more methods.

0 Kudos
Message 5 of 9
(1,652 Views)

To look for changes, just read the entire worksheet and save as an array in LabVIEW.  Compare the current contents to the array to find a specific change.

 

If your Excel data is a continuous block anywhere on the page, use ActiveCell.CurrentRegion to return the address of the data.

 

If your Excel data is spread out in the workbook, use ActiveSheet.UsedRange to get the use portion of the sheet.

Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 6 of 9
(1,626 Views)

Thank You Munroe. While reading workbook I am facing fast excel opening and closing issue (like a flicker). I am setting Excel Visible property on application, but that seems not to work. The flickering is also inconsistent. Do you have any thoughts to share on this?

0 Kudos
Message 7 of 9
(1,615 Views)

ActiveX will allow you to secretly sneak into the workbook in memory and grab anything you want.  The worksheet does not have to be visible for this.

 

There is no reason to try to change the state or appearance of the workbook.   Leave it in whatever state it is already in.  Do not open or close Excel.  Do not open or close the workbook.  Do not show, hide or alter the visibility of the application. 

Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 8 of 9
(1,607 Views)

Hello Michael,

 

My requirement is that I will not be aware before hand whether the required workbook will be opened or closed. Hence, If workbook is not opened in excel already (looking through the workbooks names in Activex), I am opening it(using 'Open' method in Activex). If its already opened, I am getting the workbook reference through activex and using it. So when I open the workbook, sometimes (not always) Excel opens and closes automatically. I am not able to recreate the actual scenario. Also when I open a file from network drive, I am getting 'Downloading' progress popup only in my PC but not in my colleagues PC. May be some Excel environment settings, not sure. As the issue is not consistent, we are not after this issue for now. But if you can share your thoughts on any of above two scenarios, it will be a useful knowledge sharing. Thank you for all your replies in the past!! Kudos!!!

0 Kudos
Message 9 of 9
(1,590 Views)