+ Reply to Thread
Results 1 to 21 of 21

How to get folder path for xltm file

Hybrid View

  1. #1
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to get folder path for xltm file

    This code should be run once in the template file, personally I just ran it from the Immediate Window (CTRL+G).
    ThisWorkbook.CustomDocumentProperties.Add "TemplatePath", False, msoPropertyTypeString, ThisWorkbook.Path
    Once it has been run every new workbook created from the template file will have access to the custom property 'TemplatePath'.

    If you put this code in the Open event it will run every time a new workbook is created from a template and will try and create another custom property named 'TemplatePath' and Excel/VBA is not going to like that.
    If posting code please use code tags, see here.

  2. #2
    Forum Contributor
    Join Date
    08-20-2009
    Location
    new york
    MS-Off Ver
    Excel 2003
    Posts
    119

    Re: How to get folder path for xltm file

    Quote Originally Posted by Norie View Post
    This code should be run once in the template file, personally I just ran it from the Immediate Window (CTRL+G).
    ThisWorkbook.CustomDocumentProperties.Add "TemplatePath", False, msoPropertyTypeString, ThisWorkbook.Path
    Once it has been run every new workbook created from the template file will have access to the custom property 'TemplatePath'.

    If you put this code in the Open event it will run every time a new workbook is created from a template and will try and create another custom property named 'TemplatePath' and Excel/VBA is not going to like that.
    Thanks. Now I removed the code Workbook_open, and it works now. So it returns the error message, because the property is already there?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 12-29-2015, 04:19 AM
  2. Choosing folder path (instead of file path) in VBA
    By sminter in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-23-2014, 08:50 PM
  3. [SOLVED] file name from folder path
    By Sundarvlr in forum Excel General
    Replies: 3
    Last Post: 04-17-2014, 01:36 PM
  4. Code to list the folder path and sub folder path of a specific file
    By kalai1587 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2013, 03:51 AM
  5. [SOLVED] how to insert file path of every file in a folder as a string?
    By Gamekiller48 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-31-2013, 02:01 PM
  6. [SOLVED] Save As Dialog Box - Default Path and File Name, User Selects Sub Folder from Default Path
    By christenprochaska in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2012, 05:17 PM
  7. Specified folder path to select file path
    By JayEmTee91 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-29-2012, 10:38 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1