How to open workbook from workbook template without hardcoding

  • Thread starter Thread starter Michael Turner
  • Start date Start date
M

Michael Turner

Hi

Thanks for the answer to my previous question but I left out a vital point
sorry.

Could anyone tell me how to open a workbook from a workbook template, where
both files are in the same folder, without hardcoding the path. I have tried
code like this without success.
Workbooks.open (Thisworkbook.path & "\somefile.xls")

This code works fine when opening a workbook from another workbook, but
not from a template.

Thanks in advance

Mick
 
If the file that contains the code was based on a template, then you're going to
have to save it before it has a .path property.

(If you created the new workbook in code, then maybe you can use the same folder
as you did then. If you don't know where the template was located (the user
opened it manually), then I think you've got trouble. Excel doesn't keep track
of the originating template location--it's not like word.)
 
Back
Top