title: Using Environ$(“USERPROFILE”) VBA save to path
body: <p>I am new to VBA, so apologies for my ignorance.
  I have a very complicated macro in Excel 2016 that I need to edit.
  It is related to <a href="https://stackoverflow.com/questions/47316486/export-data-from-excel-to-pdf-form-without-saving-it-as-csv-or-other-file-first?noredirect=1#comment81584538_47316486">this previous discussion</a></p>
  
  <p>I need to change the output save path of a created .pdf. Right now it is using the Excel location as a starting point, (ThisWorkbook.Path) and was saved into that same folder. </p>
  
  <p>But now it needs to save to a different folder which will be on a shared Box drive. The path will change depending on who is accessing the file.</p>
  
  <p>So how should I use Environ$ to indicate that <strong>C:\Users\johnsmith</strong>\Box\etc. etc.  will change and everything after \Box\etc. etc. is constant?
  It is using values from the Excel spreadsheet to make up the new file name.</p>
  
  <p>Here's the bit I need to edit:</p>
  
  <pre><code>With shDetail
          If llRow - 3 &lt; 10 Then
              strPDFOutPath = ThisWorkbook.Path &amp; "\2018 Payments\0" &amp; .Cells(llRow, 14).Value &amp; "_" &amp; .Cells(llRow, 3).Value &amp; "_" &amp; "file" &amp; ".pdf"
          Else
              strPDFOutPath = ThisWorkbook.Path &amp; "\2018 Payments\" &amp; .Cells(llRow, 14).Value &amp; "_" &amp; .Cells(llRow, 3).Value &amp; "_" &amp; "file" &amp; ".pdf"
          End If
      End With
  
      'Save the form as new PDF file.
      objAcroPDDoc.Save 1, strPDFOutPath
  </code></pre>
  
  <p>So should it be</p>
  
  <pre><code> strPDFOutPath = Environ$(“USERPROFILE”) &amp; Box\Folder1\Folder2\Folder3\0" &amp; .Cells(llRow, 14).Value &amp; "_" &amp; .Cells(llRow, 3).Value &amp; "_" &amp; "file" &amp; ".pdf"
          Else
              strPDFOutPath = Environ$(“USERPROFILE”) &amp; Box\Folder1\Folder2\Folder3" &amp; .Cells(llRow, 14).Value &amp; "_" &amp; .Cells(llRow, 3).Value &amp; "_" &amp; "file" &amp; ".pdf"
  </code></pre>
  
  <p>?</p>