LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automating a Excel file with embedded VBA code

Hi,

I am using report generation toolkit to export sizable amount of data to a macro enabled excel(.xlsm) file that should run the macro when all the worksheets have been populated & the labview application writes a terminating string "ready" to a particular cell in the "Summary" worksheet which triggers the macro into action.

Just wanted to clarify the following:

1.Does the excel close only after the VBA code execution is fully complete?

2. Does the "ready" trigger in the "Summary" sheet is actually written after all the other worksheets are populated?

I feel that both the above are true , but somehow I don't feel confidant!!

0 Kudos
Message 1 of 3
(2,183 Views)

If I said "Yes", or if I said "No", how would you know I was correct?  Even if NI says in the Help File "It works this way", that is far more likely to be correct than whatever I might say, but it isn't a 100% Sure Thing.

 

You, however, have a Test Case, some code that you can run and see if it behaves as you would hope.  I would suggest running it with and without the final Dispose Report (to see if/how it makes a difference).

 

Your use of the Error Line and Excel Report Class Wires is exemplary.  However, you need to realize you are giving commands to another program that might not obey LabVIEW's Principle of Data Flow.  Indeed, there are instances in using the RGT when a delay of a tenth of a second is a good idea.  Testing will help reveal these "unexpected" surprises.

 

Bob Schor

0 Kudos
Message 2 of 3
(2,164 Views)

Thanks Bob.

I'll test & report back.

Delay before disposing of the report , you mean??

Good idea....I'll try that also.

0 Kudos
Message 3 of 3
(2,152 Views)