LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

macro argument

How do I create arguments in macro? I know how to call the macro and send in argument in LabView, but how do you create the argument in Excel macro? Thanks.
0 Kudos
Message 1 of 4
(3,205 Views)
Place the name of the parameter and it's type in the Sub line in the macro. The first parameter will be Arg1 in LabVIEW.

Sub CreateSheet(strShName As String)

With Sheets.Add(after:=Sheets(Sheets.Count))
.Name = strShName
End With
End Sub

Once you include parameters in macros, you will not be able to run them directly from the worksheet.

Michael Munroe
www.abcdefirm.com
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
Message 2 of 4
(3,205 Views)
What if your parameter is an integer, how would you pass it in? Thanks.
0 Kudos
Message 3 of 4
(3,205 Views)
Just define the data type as an Integer instead. When you wire an input the the Arg1 terminal, Excel will pass it as a Variant and determine the type using the Macro definition.

Sub DeleteSheet(intSheetIndex As Integer)
If intSheetIndex <= Sheets.Count Then
Application.DisplayAlerts = False
Sheets(intSheetIndex).Delete
Application.DisplayAlerts = True
End If
End Sub

Michael Munroe
www.abcdefirm.com
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 4 of 4
(3,205 Views)