Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    May 2002
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AttachedTemplate.Path property for Excel? (Excel 97/2000)

    Does anyone know how to simulate Word's .AttachedTemplate.Path property for Excel? When an Excel Template is run (eg. through File | New) I want to find out the path to the actual Template file.

    Thanks

  2. #2
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AttachedTemplate.Path property for Excel? (Excel 97/2000)

    I don't think you can retrieve the template path from a Workbook property. There are two Application properties that allow you to find the template's path (if there are templates, otherwise it will return an empty string) (but that's a general application property):

    <pre>Sub test()
    Dim TemplatePath As String
    TemplatePath = Application.NetworkTemplatesPath
    MsgBox TemplatePath
    TemplatePath = Application.TemplatesPath
    MsgBox TemplatePath
    End Sub
    </pre>


  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: AttachedTemplate.Path property for Excel? (Excel 97/2000)

    Thanks, Hans. I just this morning ran into a need for this kind of information, and took your stuff and wrote this:

    Sub listDefaultLocations()
    Dim strLclTmpltPth As String
    Dim strNtwrkTmpltPth As String
    Dim strStdStrtFPth As String
    Dim strAltrnStrtFPth As String
    Dim strDefltFSavePth As String

    strNtwrkTmpltPth = functPathExists(Application.NetworkTemplatesPath)
    strLclTmpltPth = functPathExists(Application.TemplatesPath)
    strAltrnStrtFPth = functPathExists(Application.AltStartupPath)
    strStdStrtFPth = functPathExists(Application.StartupPath)
    strDefltFSavePth = functPathExists(Application.DefaultFilePath)

    MsgBox _
    "Local Templates Path: " & strLclTmpltPth & Chr(10) _
    & "Network Templates Path: " & strNtwrkTmpltPth & Chr(10) _
    & "Standard Startup Files Path: " & strStdStrtFPth & Chr(10) _
    & "Alternative Startup Files Path: " & strAltrnStrtFPth & Chr(10) _
    & "Default File Save Path: " & strDefltFSavePth
    End Sub

    Function functPathExists(ByRef Path As String) As String
    functPathExists = Path
    If Len(Path) = 0 Then functPathExists = "<none specified>"
    End Function

    Are there other default Excel locations which would be handy to know, and is there a more efficient way to write this?
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AttachedTemplate.Path property for Excel? (Excel 97/2000)

    There is also a LibraryPath (the directory where add-ins are stored), Path (which returns the path where Excel is installed), UserLibraryPath (which returns the location of Excel's COMAdd-ins). That's about it, I think.

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: AttachedTemplate.Path property for Excel? (Excel 97/2000)

    Thanks. In XL97, there doesn't seem to be Application.UserLibraryPath Property?
    -John ... I float in liquid gardens
    UTC -7ąDS

  6. #6
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Kortrijk, Belgium
    Posts
    571
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AttachedTemplate.Path property for Excel? (Excel 97/2000)

    That's right. COM Add-ins are supported from Excel 2000 onwards.

Posting Permissions

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