title: VBA: How to run another application from MS Access
body: <p>I've been trying to get this issue figured out, and it seems that I cannot find the solution to the problem anywhere. Here was the first part: <a href="https://stackoverflow.com/questions/10439024/vba-shell-command-always-returns-file-not-found">VBA Shell command always returns &quot;File Not Found&quot;</a> In that question, it wasn't finding the application in the %APPDATA% folder for some odd reason, likely a security setting. </p>
  
  <p>I have since moved the import tool to the same directory that I store the database in, with the small hope of getting it to work correctly. </p>
  
  <p>My objective is to click a button in MS Access and have it run my import tool directly. Right now, I have it opening the folder that holds the tool. This works on my development machine which has admin privileges, but does not work on other machines without admin privs. The code right now looks something like the following:</p>
  
  <pre><code>Dim hProcess as Long
  Dim myPath as String
  Dim ex as String
  
  ex = "C:\WINDOWS\explorer.exe "
  myPath = Environ("ProgramFiles(x86)") &amp; "\mytool\"
  
  hProcess = Shell(ex &amp; myPath, vbNormalFocus)
  </code></pre>
  
  <p>This allows the folder that holds the file to be opened, but only on machine accounts which have full administrator privileges. When running this on a machine account that has less than full privileges, it simply does nothing.</p>
  
  <p>I have also tried the following:</p>
  
  <pre><code>Dim hProcess As Long
  Dim myPath as String
  
  myPath = Environ("ProgramFiles(x86)") &amp; "\mytool\mytool.exe"
  hProcess = Shell(myPath, vbNormalFocus)
  </code></pre>
  
  <p>This section "seems" to work in that it loads the application "mytool.exe" when I look at the process manager. However, after a few seconds (maybe 20), a dialog pops up stating that the application "mytool.exe" has stopped working.</p>
  
  <p>One thing to note here is that I have admin privileges on my development machine, but I have all privileges on my home machine. On my home machine, this second code works with no issue whatsoever. At my development machine, it crashes, while on a restricted user machine, it doesn't do anything at all.</p>
  
  <p>Are there any suggestions on how to open this application from MS Access while using less-than-admin privileges? Either to run the application directly or to at least open the folder in which said application resides.</p>
  
  <p>Thanks!</p>
  
  <p>P.S. I have tried both ShellAndWait and RunApplication code found on stackoverflow, neither of which works in this instance.</p>