The objective with this routine is to open/run a simple .exe located in the same folder as the workbook, presumably in a subfolder of a user's documents folder. User name and subfolder name will vary.
In the code below, I get the first 2 Call Shell line to work. But the third gives me "Run-time error '53': File not found"
I really need this third line to work.
One option I have is to have the exe in a predefined folder such as c:\program files\RO or in an appdata folder.
I don't want this to simplify distribution, keeping the workbook and ROInd2CSV.exe together in a single easy to 'install' package.
Application.ActiveWorkbook.path yields a value of "https://d.doc.live.net/#########/Documents/RRO"
Is OneDrive somehow messing with this, keeping the file from being found?
Code: Select all
Sub OpenROInd2CSV()
' Open ROInd2CSV.exe
Dim folderPath As String
folderPath = Application.ActiveWorkbook.path
MsgBox folderPath
'Call Shell(Environ("UserProfile") & "\OneDrive\Documents\RRO\ROInd2CSV.exe", vbNormalFocus)
'Call Shell("C:\Users\[USER NAME]\OneDrive\Documents\RRO\ROInd2CSV.exe", vbNormalFocus)
Call Shell(Application.ActiveWorkbook.path & "\ROInd2CSV.exe", vbNormalFocus)
End Sub