Hello AlexXYZ,
Copy and paste this code into a VBA Module. Call the macro "RunFile" to start "TestRun.r".
Private Declare Function ShellExecute _
Lib "Shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long
Sub RunFile()
Dim CmdLine As String
Dim ExePath As String
Dim Ret As Long
CmdLine = "C:\DirectoryB\TestRun.r"
ExePath = "C:\DirectoryA\Rscript.exe"
Ret = ShellExecute(0, "open", ExePath, CmdLine, Chr(0), vbNormalFocus)
End Sub
Bookmarks