The FileSystemObject was only an example. Any object which was implicitly used can produce the error message.
Add error handling where you expect the error to appear.
You can even add errorlines to locate the exact line where to error occures.
Again an example. Don't try to compile, doesn't work, constants are missing. Is only an example
Code:
Function MapSelect(strPrompt As String)
'Variables with a "c" prefix are constants
Dim oSHApp
Dim oFolder ' as folder object
10 On Error GoTo Err_MapSelect
20 Set oSHApp = CreateObject("Shell.Application")
30 Set oFolder = oSHApp.BrowseForFolder(cDesktop, strPrompt, cOptions, cRootFolder)
40 MapSelect = oFolder.ParentFolder.ParseName(oFolder.Title).Path
Exit_MapSelect:
50 On Error GoTo 0
60 Exit Function
Err_MapSelect:
70 MsgBox "Error " & Err.Number & " (" & Err.Description & ") in line " & Erl & " in procedure MapSelect of Module Module1"
80 Resume Exit_MapSelect
90 Resume ' for debugging purposes
End Function
Enjoy!