I am updating a VBA program (excel). At startup the program checks if it can find a directory which is on the office fileserver using:
FileSystemObject.FolderExists("\\servername\path")
If this is not found the program switches to offline mode and saves its output to the local hard disk (for later transfer), instead of directly to the fileserver.
This works OK, It's very quick if the computer can reach the path, however it can sometimes take a while (up to one minute) for the call to FolderExists to complete/time-out, especially if there is a network connection open but the required path does not exist (i.e. we are connected to some other LAN).
My Question(s):
is there a quicker/better way to check for the existence of a network path using VBA?
is there a way to have the user cancel the search done by FolderExists() when (s)he knows it cannot succeed because they're not in the office. I.e. is there some way to prematurely exit FolderExists() (or any other function call for that matter)
I want the solution to have as little user input as possible, which is why the check is done automatically, rather than just asking the user if (s)he's in the office or not in the first place.