Access/VBA Library


Returns a String expression containing the path to the user specific folder for the application. The folder will a subfolder in the AppData-folder and it's name is the name of the application.

When the folder does not exist it will be created.


Return value

String : Path to the application folder.

Function GetApplicationFolder() As String

    Static appFolder As String
    Dim fs As FileSystemObject
    If appFolder = "" Then
        appFolder = GetAppData() & "\" & GetWord(GetApplicationTitle(), 1)
        Set fs = New FileSystemObject
        If Not fs.FolderExists(appFolder) Then
            fs.CreateFolder appFolder
        End If
    End If
    GetApplicationFolder = appFolder
End Function


  • Because this function probally is called more than once, the application folder is stored in a static variable.
  • Because my applications has a version number added to the application title, only the first word of the application title is used to determine the name of the folder!.

See also

  • GetAppData
  • GetApplicationTitle
  • GetWord