LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Please show me how to create multiple charts using Labview activeX

Can some one show me how to create multiple charts in excel using Labview active X, or tell me how?   I use labview 7.
0 Kudos
Message 1 of 4
(5,661 Views)
Hi,

To create multiple charts in excel, you would simply need to use LabVIEW as an automation client to communicate to Excell as the server.  To create multiple charts, you will need some knoweldge on Excel object modeling.  I have attached a link for more information on how to use the automation client with excel and LabVIEW.  I have also attached a simple search and have provided the results below. 

LINK1
LINK2


Goodluck,

Nadim
Applications Engineering
National Instruments
0 Kudos
Message 2 of 4
(5,641 Views)

I have attached a zip file with these files

Chart Data File.vi                             - This VI creates some data and saves the data into "Data File.xls". Its a tab-delimited file

Data File.xls                                     - This is the file containing the data from your LabVIEW application

ProcessDataFile.xls                        - This spreadsheet is loaded by Chart Data File.vi. It contains the macro to load.

ChartDataFromFile-Original.txt       - This the original macro I recorded to load the file into Excel,select range, chart, resize and reposition chart in column in order.

In this case a lttle more work is required to completely automated the loading of the data file and to create 3 charts from the data. I modified the VBA Procedure ChartDataFromFile() to use an string argument which is the path of the data file. This allows me to automate Workbooks.OpenText. The next thing is that ActiveChart.SetSourceData uses a fixed range A1:101, for example. To get around this I created a range object variable rngMeasRange to store the current selection which can then be used to automate ActiveChart.SetSourceData also. You can see the changes from the original macro in "ChartDataFromFile-Original.txt" to the more automated version in ProcessDataFile.xls using the VBA Editor.

This example vi uses sub-vis from ExcelExamples.llb so you will need to add examples to your vi search path under Tools -> Options. Alternatively you can load up Excel Macro Example.vi from Example Finder to make sure the sub-vis are loaded already in memory before you load Chart Data File.vi.                         

Hope this gives you an idea of the power of labview and excel vba together.

David

Message 3 of 4
(5,627 Views)
I have just noticed that the example VI I uploaded was LV7.1 so here is the VI in 7.0 format.
 
David
Message 4 of 4
(5,610 Views)