title: How can I debug Run Time Error ‘76’ in Microsoft Visual Basic for Excel with Mac OSX?
body: <p><strong>Background</strong></p>
  
  <p>The statistical program that I’m running was created by a research institute and consists of an Excel interface, a Matlab-based graphical interface, and a Fortran program that operates all calculations. You can find more information here: <a href="https://ec.europa.eu/jrc/en/econometric-statistical-software/gap" rel="nofollow noreferrer">https://ec.europa.eu/jrc/en/econometric-statistical-software/gap</a></p>
  
  <p><strong>Problem</strong></p>
  
  <p>The Excel interface serves to load the data, to specify the model, and to read the output. Users must specify in the Excel interface the directory where all output files are to be saved. When you open the Excel workbook, the example for the directory is: <code>H:\ARossi\GAP50EXE</code></p>
  
  <p>Since I have a Mac, I specify the directory by clicking “command + i” and then copying and pasting the folder path, which looks like this: <code>/Users/MyName/Documents/GAP50EXE</code></p>
  
  <p>After I click the “Run” button on the Excel page, a message pops up that reads: “Microsoft Excel needs to access the folder named ‘Documents’. Select this folder to grant access.” I then grant access to my “Documents” folder.</p>
  
  <p>I then get the following error message: </p>
  
  <blockquote>
    <p>“Run-time error ‘76’. Path not found”</p>
  </blockquote>
  
  <p>When I click “Debug”, the VBA code opens up and points to the following code:</p>
  
  <pre><code>output = NewPath &amp; "\BIN\WIN32\bgapint50 " &amp; NewPath
   MyAppID = Shell(output, 1)        ' Run BGAPINT50.exe
   Worksheets("OutputBayes").Cells(1001, 2).Value = 1  ' to load data or not with "Show graph"
  
  Else ' Call GAP50.exe
  
   output = NewPath &amp; "\gap50.exe " &amp; NewPath &amp; "\gap50.nml  &gt; " &amp; NewPath &amp; "\outfile.txt"
   MyAppID = Shell(output, 1)  ' Run Fortran code GAP50.exe
   Worksheets("OutputML").Cells(1001, 2).Value = 1  ' to load data or not with "Show graph"
  
  End If
  </code></pre>
  
  <p>The line <code>MyAppID = Shell(output, 1)        ' Run BGAPINT50.exe</code> is highlighted in yellow, indicating this is where the problem is. Also, when I scroll over the object <code>MyAppID</code>, it reads <code>MyAppID = EMPTY</code>.</p>
  
  <p><strong>What I've already tried</strong></p>
  
  <ol>
  <li>I downloaded the program on a friend’s PC and everything ran perfectly.</li>
  <li>I’ve tried almost every conceivable file naming convention. I’ve used <code>:</code> and <code>/</code> and different combinations of them all.</li>
  </ol>
  
  <p><strong>Questions</strong></p>
  
  <ol>
  <li>Is there a file/folder path naming convention that could fix this problem?</li>
  <li>Is the access permission causing my problem? </li>
  <li>Do I need to modify the VBA code to be compatible with a Mac? If so, how so?</li>
  </ol>