• Location of special folders (WinXP NL/Word2003 NL)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Location of special folders (WinXP NL/Word2003 NL)

    Author
    Topic
    #416629

    After a new install, Word defaults to saving documents in the MyDocuments folder. Normally this folder is located in C:Documents And Settings…. But users can change this:
    – in Word they can change the location in Tools | Options, tab File locations
    – in Windows they can change the location of MyDocuments (using TweakUI etc.)

    You can find Word’s location using Options.DefaultFilePath(wdDocumentsPath). Is there a way using VBA to get the location of the MyDocuments folder, or any of the other special folders for that matter? (Windows, Program Files, etc.)

    Viewing 1 reply thread
    Author
    Replies
    • #932502

      You can use Windows API functions for this. See SHGetSpecialFolderLocation, and click on Special Folder under examples.

    • #932503

      Or get the info from the registry:

      Dim strPath As String
      strPath = System.PrivateProfileString(“”, “HKEY_CURRENT_USERSoftware” & _
      “MicrosoftWindowsCurrentVersionExplorerShell Folders”,”Personal”)

      Look up HKEY_CURRENT_USERSoftware…Shell Folders in RegEdit to see the other available values.

    Viewing 1 reply thread
    Reply To: Location of special folders (WinXP NL/Word2003 NL)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: