LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I slow dow the execution of 1 VI?

Hi,

I am running this vi in the middle of a sequence.  It is to run an Excel macro.  When running at regular speed, (not highlighted), I always get:

 

Error 1 occurred at Incorrect function.
 in Do_It Macro.vi

Possible reason(s):

LabVIEW:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
=========================
NI-488:  Command requires GPIB Controller to be Controller-In-Charge.

 

I'm not using GPIB at all.  If I run the vi with process highlighting ON, which makes it run slower, it work OK.

I don't understand why.

I am including a copy of the vi in case anybody cares to take a look.

Thank you,

Bob

0 Kudos
Message 1 of 7
(2,583 Views)

Try adding a time delay before you call your macro.  You might be trying to call the macro before your worksheet has opened.

 

 

Brian
0 Kudos
Message 2 of 7
(2,574 Views)

Error code 1 could mean different things.  It means one thing if it is a LabVIEW error, another thing if it is GPIB error.  Since you are not using GPIB, you can ignore that part of the error message, it is the top part of the error message that is meaningful to you.

 

I am going to guess that the opening of the workbook is taking some time and Excel is not ready to execute the Run Macro command immediately.  You could put a small flat sequence frame between the nodes where you want to wait, run the wires through that frame and also put in a Wait function.  Do you know exactly which node is generating the error?  Use some probes on the error wires to see where the error is getting raised.

 

One thing that seems odd to me is the path to string function before the run macro node.  I don't know if it would recognize the !My_Stocks_Do_It part.  My understanding is that the path to string function works based on the rules of the operating system.  But the !My Stocks .....  is a path whose syntax is only meaningful to Excel.

 

Another thing.  Be careful how you close the references at the end.  You are closing them in parallel, thus you have no control over what closes first.  If you close the application reference before the workbooks reference, you would lose the ability to close the workbooks reference and wind up with a memory leak.  Close the references in series in the reverse order that yo opened them.  Also, it looks like you are closing the _Application reference multiple times because you split that wire before using it in a few locations, but are using multiple Close References to close each branch after it is used.

Message 3 of 7
(2,561 Views)

Hi Brian,

 

I already have a 3 second delay.

 

Thanks for replying,

Bob

0 Kudos
Message 4 of 7
(2,550 Views)

I'll take a closer look.

Thanks,

Bob

0 Kudos
Message 5 of 7
(2,549 Views)

Ravens Fan wrote:

But the !My Stocks .....  is a path whose syntax is only meaningful to Excel.


This is just a quick guess, but there's still a coersion dot at the macro input.  Try using !My Stocks... in either path or string and using a To Variant primitive to dump it into your macro.
Message Edited by JeffOverton on 09-09-2008 03:58 PM
Message 6 of 7
(2,518 Views)

As suggested, I stuck probes on my error lines, and took a look at how the references were closed and found that I had to do a bit of re-modeling.  My issue if fixed now.

Thank you all for your suggestions.  I learned something today.

Thanks again,

Bob

0 Kudos
Message 7 of 7
(2,494 Views)