Function CorrectPath(FolderPath As String) As String
'If FolderPath has trailing backslash, remove it.
FolderPath = Trim(FolderPath)
If Right(FolderPath, 1) = "\" Then
CorrectPath = Left(FolderPath, Len(FolderPath) - 1)
Else
CorrectPath = FolderPath
End If
End Function