Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Feb 2010
    Location
    Denver, CO
    Posts
    191
    Thanks
    0
    Thanked 0 Times in 0 Posts

    path variables (VBA)

    Does anyone have a list of path variables? For example: There is a variable that will point to the system directory. I think it is %WINROOT% or some such thing like that. I've seen various ones, such as to the application data folder of the current user, the current user's documents and settings folder,etc. Can anyone help me out. thanks.

    I'm wanting to place a file in my user's documents and settings folder, but need to know what user is logged on, etc. How is this done?

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

    Re: path variables (VBA)

    Which App? Here are some that are available in Excel:

    Application.Path
    Application.DefaultFilePath
    Application.TemplatesPath
    Application.NetworkTemplatesPath
    Application.StartupPath
    Application.AltStartupPath
    Application.LibraryPath

    For the logged in user, see <!post=this thread,293049>this thread<!/post>. Search this forum for other specific default paths you may need. Many of them can be obtained from the Environment String variables, but can be installation dependent and thus not reliable.
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: path variables (VBA)

    If Windows Scripting is available to you, the following function might be useful, : <pre> Function GetSpecialFolderPath(strFolder) As String
    Dim wshShell
    Set wshShell = CreateObject("Wscript.Shell")
    GetSpecialFolderPath = wshShell.SpecialFolders(strFolder)
    Set wshShell = Nothing
    End Function</pre>

    If you pass any of the following folder names to the function, the path to that special folder should be returned.

    AllUsersDesktop
    AllUsersStartMenu
    AllUsersPrograms
    AllUsersStartup
    Desktop
    Favorites
    Fonts
    MyDocuments
    NetHood
    PrintHood
    Programs
    Recent
    SendTo
    StartMenu
    Startup
    Templates

    Andrew C

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: path variables (VBA)

    Also <pre>SpecialFolders("AppData")</pre>


Posting Permissions

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