cancel
Showing results for 
Search instead for 
Did you mean: 

Inconsistent Variant to Data Errors

SOLVED
buickgn
Member

Re: Inconsistent Variant to Data Errors

Message contains an attachment

Sure. Sorry about that. The excel files are in previous posts.

GregFreeman
Trusted Enthusiast

Re: Inconsistent Variant to Data Errors


@PiDi wrote:

I can't check it now, so this is a pure guess:

 

Try putting additional time delay between Worksheet.Activate and executing VLookup.



For future reference with regards to this, there is actually a callback that you can capture from Excel when it's ready. So, I usually set a busy cursor, then unset it when I get this callback. This way you aren't guessing how long it will take before it's started up, because this can vary depending on your processor, if you just rebooted, what other work the PC is doing etc. I will find the exact callback once I get my code out of SCC

GregFreeman
Trusted Enthusiast

Re: Inconsistent Variant to Data Errors

Message contains an image Message contains an attachment

Here's what I was suggesting in my previous post. I register for all Excel callbacks I want to register for in the VI shown at the bottom. The VI at the top is the VI that is called when a callback is received, which then fires an appropriate user event. I capture that event with my event structure.

 

Nathan-P
NI Employee (retired)
Solution

Re: Inconsistent Variant to Data Errors

Message contains an image Message contains an attachment

So I tested your code, and individually they work, like you said.  So I did the following:

test_sequence.png

 

And now I do not get the error on the variant.  

 

I haven't looked too deeply into this, but it looks like something in your VI's is not thread safe, so ensuring they don't run at the same time solves the problem.

 

I hope this helps.

Systems Engineer
SISU
buickgn
Member

Re: Inconsistent Variant to Data Errors

Works perfect! Thanks Nathan!