How to get path

langhout
04-08-2008, 01:38 PM
This is the first time for me on this forum opening a thread. Please help me if i'm doing something wrong.

I'm looking for a code to get the path where a shortcut to a template is opened.

for each project a have a standaard directory and subdirectory with in the subdir calculation a shortcut to an excel template file called calculation.xlt.

the standaard directory lay-out is copied to and renamed to another directory with active projects.

When i open the shortcut to the template file i want to have the path where i opened the shortcut to save the opened file with the right name accourding to the name of the project.

I tried activeworkbook.path and thisworkbook.path but there empty because i started from a template which i not not saved yet. Also curdir doesnt work.

Mill
04-09-2008, 11:50 AM
You could just let the user browse for a folder instead of the template itself.

http://www.j-walk.com/ss/excel/tips/tip29.htm

This way, you'll know the folder/path information, and if the template always has the same name, you could do the rest via code.

langhout
04-09-2008, 02:17 PM
Thanks for you're reply.

It has given me some thoughts.

(a) Normally the user picks up the shortcut from the directory which want to use in VBA, so how can this directory be used?

(b) When I put in a macro button to open the file the user has to select the directory and the other actions can continue.

I hope you' can suggest me more for (a).

Mill
04-09-2008, 02:19 PM
I just don't know what options are available to you, since, because the workbook isn't saved yet, you don't have a valid path or fullname property. If CurDir() doesn't work, then I'm not sure what to suggest.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum