06-07-2011 01:36 AM
Hi everyone,
I would like to use a macro in every .XLS file that LabVIEW will open. The macro is in a .XLSM file.
How to make it on LabVIEW ??
Here is my macro:
Sub Incrémental() Dim Sh As Worksheet Dim Ch As Chart Dim i As Integer Application.ScreenUpdating = False On Error Resume Next Application.DisplayAlerts = False Sheets("Graph").Delete Application.DisplayAlerts = True On Error GoTo 0 Set Sh = ThisWorkbook.Worksheets(1) Set Ch = ThisWorkbook.Charts.Add(After:=ThisWorkbook.Worksheets(1)) With Ch For i = .SeriesCollection.Count To 1 Step -1 .SeriesCollection(i).Delete Next i .Name = "Graph" .ChartType = xlXYScatterSmoothNoMarkers .SeriesCollection.NewSeries With .SeriesCollection(1) .Name = "T° Sample (°C)" .XValues = Sh.Range("A:A") .Values = Sh.Range("B:B") End With .SeriesCollection.NewSeries With .SeriesCollection(2) .Name = "T° Contact (°C)" .XValues = Sh.Range("A:A") .Values = Sh.Range("C:C") End With .SeriesCollection.NewSeries With .SeriesCollection(3) .Name = "Torque (N.m)" .XValues = Sh.Range("A:A") .Values = Sh.Range("I:I") End With With .SeriesCollection(1) .AxisGroup = 2 End With .HasTitle = True .ChartTitle.Characters.Text = Sh.Name With .Axes(xlCategory, xlPrimary) .HasTitle = True .AxisTitle.Characters.Text = "Time (s)" End With With .Axes(xlValue, xlPrimary) .HasTitle = True .AxisTitle.Characters.Text = "Torque (N.m)" End With With .Axes(xlValue, xlSecondary) .HasTitle = True .AxisTitle.Characters.Text = "Temperature (°C)" End With End With Set Sh = Nothing Set Ch = Nothing End Sub
<script type="text/javascript">// (function(){var src=document.getElementById('source');src.focus();src.select();src.style.boxSizing=src.style.WebkitBoxSizing=src.style.MozBoxSizing=src.style.MsBoxSizing='border-box';})(); // </script>
06-07-2011 01:30 PM