title: Finding an Excel Spreadsheet's template path
body: <p>I have an Excel spreadsheet template with VBA code (an 'xltm' file).</p>
  
  <p>I want to find the path of the template in the spreadsheet that is opened by the template.</p>
  
  <p>Example of the problem:</p>
  
  <ul>
  <li>A user opens a new spreadsheet from the template file in 'C:\My Stuff' by double clicking it.</li>
  <li>They fill in the cells, then click a button that creates a text file after asking them what to call it.</li>
  <li>The code then uses <code>Application.ActiveWorkbook.path</code> to save the text file in the same place as the spreadsheet is open.</li>
  <li>This causes a permission error, as the spreadsheet hasn't yet been saved, and as such, doesn't have a path.</li>
  </ul>
  
  <p>Is there a way to find the original template's file path? In the example C:\My Stuff.</p>
  
  <p>I could make the user save the file before the text file is created, or I could just use an xlsm file but a template will minimise the chance of messing up the formatting of the file. I don't want to ask them to save the file each time. They'll probably copy and paste most data in, then just want the text file, not a different spreadsheet each time.</p>