How to get path to Excel template from VSTO project
I am working on a VSTO Excel 2010 Macro Enabled Template Project which I plan to package with other files / content / resources and install (WiX toolbox) on the target machine.
It is assumed that the user clicks on a shortcut (for example, from the desktop) to the Excel template, launches Excel with add-ins, and then works from there. I also have some dot reports in the install directory that need to be triggered using the VSTO Ribbon Button.
The question is how to find out the installation directory using the VSTO Ribbon button?
Since the new Excel workbook came from an Excel template, it would be nice to have something like ThisWorkbook.Template.Path.
EDIT : I understand there are two parts to this question, the first part is answered here , and the second needs clarification:
Suppose I have a template document mytemplate.xltm in C: \ templates. Then I double click on the file to open Excel and by default a "New Workbook" is created from the file. Now how can I get the path "C: \ templates" back from the "New Workbook"? I want to know where the mytemplatex.xltm file is or better yet, which file the New Workbook brought out from.
The answer to this question should give me "C \ templates \ mytemplate.xltm" in C # VSTO / Interop. Thank.
source to share