Generate VBA Code for Process Runner Manually
This topic describes how to manually generate the VBA code from Process Runner. You can run Process Runner through VBA-Excel.
To manually generate VBA code,
- Open the Excel template file for which you want to insert the run button. For example, consider
MM02.xlsxfile. - On the Developer tab, select the Button (Form Control) icon. If the Developer tab is not displayed, right-click the Excel toolbar and select Customize the Ribbon ... > Developer.
- Drop the button to the Excel sheet. The Assign Macro window appears.
- Select OK.
- Select Visual Basic.
The Visual Basic editor appears.
- Right-click VBAProject > Insert > Module.
- Insert the VBA code in the editor. Refer to the sample VBA code.
Sub btnProrExecute_Click()
Dim ProRPath As String
Dim ProcessFilePath As String
Dim CmdParam As String
Dim ShowMsg As String
'=== Process Runner Parameters ====
'ProR: Name of the Process Runner exe in installation folder.
'=== Second parameter is the path of Process Runner file that you want to run.===
'|AutoRun: Indicates that the Process file is run without intervention, when set to True. Make sure that you provide the full path to the logon shortcut file if this parameter is set to true.
'|SilentMode: Indicates that the file is run silently without displaying any error messages.
'|LogonFile: Indicates the logon shortcut file that is used to connect to SAP.
'|ExcelFile: Indicates the full path of the external Excel file from where the data is uploaded, or to where the data gets extracted.
'|StartRow: Indicates the Excel row from where the run starts.
'|EndRow: Indicates the Excel row where the run stops.
'|CloseExcel: Indicates that the Excel file that used to run a Process file is closed after the run is complete. This parameter ignores the Edit > Excel Control > Basic > Close Excel after run setting.
'|SessionID: Indicates the session identifier of current run.
'=== Process Runner .exe file path ===
ProRPath =
C:\Program Files (x86)\Innowera\Process Runner\ProR.exe'=== Process file path ===
ProcessFilePath =
C:\Users\TestUser\Documents\Innowera\ProcessFiles\MM02_Change_Material.itf'=== Make full command parameter to execute Process Runner with Process file ===
CmdParam = Chr(34) & ProRPath & Chr(34) & " " & Chr(34) & ProcessFilePath & Chr(34)
ShowMsg = "Do you want to run current Excel file with Process Runner?" & vbCrLf & vbCrLf & "This Excel file will be executed with " & ProcessFilePath
If MsgBox(ShowMsg, vbYesNo + vbQuestion) = vbYes Then
CmdParam = CmdParam & " " & Chr(34) & "|ExcelFile=" & ThisWorkbook.FullName & Chr(34) & " " & _
Chr(34) & "|AutoRun=true" & Chr(34) '& " " & _
'Chr(34) & "|LogonFile=<LogonFileName>.ilf" & Chr(34) & " " & _
'Chr(34) & "|SheetName=Sheet1" & Chr(34) & " " & _
'Chr(34) & "|StartRow=2" & Chr(34) & " " & _
'Chr(34) & "|EndRow=30" & Chr(34)
'=== Execute ===
Shell CmdParam, vbNormalFocus
End If
End Sub
- Right-click the button and select Assign Macro.
The Assign Macro window appears.
- Select the VBA method that you created.
- To determine your macro-execution level, select Macro Security and select Executing Process. The macro is run.