Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Workbook/Template Path (XL 2003)

    <P ID="edit" class=small>(Edited by SammyB on 31-Oct-08 09:47. )</P>Is it possible to get the directory path of the template or workbook that was opened?

    For example: create a directory named Sam in My Documents and create a new workbook in this directory. Is there some VBA code that will retrieve "Sam" for me. ActiveWorkbook.Path is the null string. TIA --Sam

    Edited to add more information:
    Sorry, for workbooks, ActiveWorkbook.Pat & ActiveWorkbook.FullName have the path, but if you save the workbook as a template and reopen it, then for the new workbook, FullName & Path both have a null path. I understand that, since you haven't saved the new workbook, but I really need the path of the Template that was opened. Thanks again!
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Workbook/Template Path (XL 2003)

    No, that is not possible. Unlike a Word document, an Excel workbook doesn't keep any link to the template it was created from.

  3. #3
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Workbook/Template Path (XL 2003)

    Not what I wanted to hear! <img src=/S/drop.gif border=0 alt=drop width=23 height=23> Any API trickery that could do it? None that I can think of. Thanks! --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Workbook/Template Path (XL 2003)

    You could store the path in a document variable in the template; workbooks created from the template would inherit the document variable.

  5. #5
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Workbook/Template Path (XL 2003)

    > You could store the path in a document variable in the template
    Yes, that's what I'm doing now. But, I have a production tree and a training tree, and so I have to create a different template for each.
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •