LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Code for SearchOrder when Interacting with Excel via ActiveX

Solved!
Go to solution

Hi All,

 

Thanks to this excellent thread with answers by Joe_H, I was able to write code that finds a string in an Excel file and returns the cell address, using ActiveX connectivity.

 

What I want to do now, is refine the search parameters to search by column.  I think I would do this by wiring a value to the "SearchOrder" input, as shown in the attached graphic.

 

However, I have not been able to creat a control that works.  I try to wire the string, "xlByColumns" (which is what I think should work) into the field, and it causes an error.

 

Has anyone figured out how to accomplish what I am trying to do?

 

Thanks,

 

FB

 

 

SearchOrder.png

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 1 of 5
(2,469 Views)
Solution
Accepted by topic author diarmaede

That parameter is an integer and you need to set it to 2.

 

The simplest way to get the integer if you know the string is by:

Opening Excel

Open Visual Basic (I put that icon on my quick access toolbar)

View -> Immediate Window

Type "? xlbycolumns"

the response will be 2

 

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 2 of 5
(2,463 Views)

I haven't tested this at all, but it's quick for you to try.  Try passing the numeric equivalent instead of the enumeration name.  You can obtain the appropriate value as demonstrated by this bit of .NET code (perhaps there's an equivalent using ActiveX but I don't know what it is).  Looks like xlByRows = 1 and xlByColumns = 2.

XlSearchOrder.png

Message 3 of 5
(2,462 Views)

Aha!  I tried passing an integer, but I tried to pass it "0" so it faulted out.  I'll try passing it "2" tomorrow.

 

Thanks for your help!


Cheers,


FB

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 4 of 5
(2,458 Views)

OK.  I set up a ring to pass the integer.  Works perfectly!  Thanks to all.

 

- FB

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 5 of 5
(2,438 Views)