LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rearrange excel sheet numbers

Solved!
Go to solution
Solution
Accepted by Bob_Schor

Share my additional PC conditions and i hope that help you.

 

PC : windows 10  pro x64 bit

Labview : 2013 version 32 bit

MS office Excel : 2016 version 64 bit

 

As above link inform, i just follow as below picture. Please understand that  the language is not English.

(invoke node => class select =>active X => search)

explorer74_1-1635902570596.png

And one more click the search icon.

explorer74_4-1635902927165.png

 

And select excel.exe file as below.In the case of my PC, it is the following address and you need to change the file type to all files. 

explorer74_5-1635903199236.png

 

Unusual points are to be done every time the LabVIEW is restarted.

If you have a solution to this issue, please feel free to let me know.

 

Thank you and have a good day~

 

0 Kudos
Message 11 of 12
(390 Views)

@FireFist-Redhawk :

Take Bob's comment to heart. Often times the best way is to just use the software itself. But there's always that chance that someone wants to do this programmatically for many Excel files. That being said...

 

This can technically be done programmatically in LabVIEW but there is a fairly large caveat: an index is associated with a worksheet when it gets created, and cannot be changed. So if you create 6 worksheets and move them all over, their indices will still be numbered in the order they were created.


I know this is getting old, but I was in need to have an automated script to order alphabetically my tabs. Got a bunch of excel files (approx. 30) with a bunch of random tabs (approx. 45) per excel file.

So I used your initial work (thank you!) and made it a bit more complex.

 

The 2 main issues I came across were:

  1. The RGT indexes the tabs starting with 0. The ActiveX starts with 1, so there is always the pain to make sure what's what.
  2. I don't know if this is due to an update, but I haven't experienced this actually "an index is associated with a worksheet when it gets created, and cannot be changed. So if you create 6 worksheets and move them all over, their indices will still be numbered in the order they were created."
    On the contrary: When moving a tab, its index is then changed, which forced me to come up to the conclusion: I either need to check the order again every time (very long process for so many files and tabs) OR to come up with a smarter solution. I ended up recreating the tab order blindly at every steps.

This is my working solution, sorts a file in less than 10 seconds (open, sort, save and close) and I'm happy with it, I'll feed it all my files now.

Hope that can help someone else.

0 Kudos
Message 12 of 12
(71 Views)