LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I export data table and plots into different Excel worksheets and format plot legends?

Solved!
Go to solution

I have the following VI that places a data table and 3 plots on the same Excel worksheet. Then I added Excel Get Worksheet.vi in an an attempt to place the table in Sheet1 and the 3 plots in Sheet2. However I get "Invalid Excel name ranges" error.

 

I need help with two things:

 

1. How do I export data into one worksheet and generate the plots on a different worksheet (within the same workbook)?

2. How do I make the legend appear on top of the plot area for all three plots and not just for the first plot as my code does?

 

 

Download All
0 Kudos
Message 1 of 6
(2,868 Views)
Solution
Accepted by topic author murchak

The index is use to select the OLE object (your graph here). This index start at 1 for the ActiveX properties and methods (in the report generation toolkit it starts at 0). Leaving this index at 1 you are setting 3 times the position of the first graph.

 

Use the index terminal value +1 to select the graph. I don't know about the invalid named range as I don't get this error. You didn't specify which fonction is generating this error.

 

edit: does your workbook opens with at least 2 worksheets?

 

Ben64

0 Kudos
Message 2 of 6
(2,835 Views)

No, the code does not open with two sheets. That is the first thing that I checked. 

How about the problem of the legend? On the first plot shows the legend where I want it, which is top. Why do the other two plots show the legend on the right (which I guess is the default location)?

 

 

0 Kudos
Message 3 of 6
(2,826 Views)

I figured out the first problem. Now, all I need is why the legend does not appear on the top for the second and third plot.

0 Kudos
Message 4 of 6
(2,813 Views)

murchak a écrit :

I figured out the first problem. Now, all I need is why the legend does not appear on the top for the second and third plot.


You should precise what was the issue as it might help someone else. My first post is the solution to the legend position part.

Ben64

 

0 Kudos
Message 5 of 6
(2,809 Views)

Thank you! I accepted your answer as a solution. I added 1 to the for loop index and wired the result into the index under Worksheet: Invoke Methods: OLEObjects. This took care of the legend issue.

0 Kudos
Message 6 of 6
(2,795 Views)