title: UserProfile environ on vba
body: <p>First I'm new to vba coding .  I wrote a form in Access 2013 - VBA and created a function that generates a PDF/txt document on button click, thing is that boss wants it to save on a shared folder that´s located on <code>%userprofile%</code> path - like <code>C:\Users\&lt;username&gt;\folder</code> and we have a lot of users.</p>
  
  <p>How can I add to the path of the SaveAs2 that i´m using without having to hardcode to each user? </p>
  
  <p>Code is like:</p>
  
  <pre><code>file.SaveAs2 = ("C:\Users\username\folder\filename.pdf")
  </code></pre>
  
  <p>I tried defining code like:</p>
  
  <pre><code>Dim filepath as string 
  filepath = environ("USERPROFILE")
  </code></pre>
  
  <p>and then:</p>
  
  <pre><code>file.saveas2 = (filepath &amp;"\folder\filename.pdf") 
  </code></pre>
  
  <p>but still no success.</p>
  
  <p>Thanks for any help</p>