Hi, sorry if this is a simple fix. I have created a user environment variable and named it OLIMARO.
This environment variable is supposed to point to the following folder: %userprofile%\documents\olimaro-2.3\
in the file path referenced above, I want to run a batch file named "run_olimaro.bat" via vba.
I have created this macro but it doesn't seem to be working
Sub RunOlimaro()
Dim folderPath As String
folderPath = Environ("OLIMARO")
Shell folderPath & "\run_olimaro"
End Sub
However placing the full path without specifying the environment variable seems to run.
Shell c:\Users\Chinoxl\documents\olimaro-2.3\
but I dont want to run the full path as I need it to run on a different computer where the folder path might be different.
What am I doing wrong? Please help.
EDIT: The solution was: Excel needs to be restarted each time the path in an existing environment variable is changed before the new path can be considered in the code. Using MsgBox in reading the value from the Environment variable path was helpful in recognizing what path was referenced in VBA.
Bookmarks