I have the following code to check for the existence, or not, of a backup directory with three possible paths.
Path "H:\" is a network path that may, or may not, be connected. If it is not connected I get "Bad file name or number" error.
Is there a way to check if the path exists other than DIR()
NOTE. The "pathX" string variables are predefined as public.
Path "H:\" is a network path that may, or may not, be connected. If it is not connected I get "Bad file name or number" error.
Is there a way to check if the path exists other than DIR()
NOTE. The "pathX" string variables are predefined as public.
Code:
Public Sub setPathways()
pathA = "H:\"
GetPath:
If Dir(pathA & "Herbarium Data\Backup", vbDirectory) = "" Then
pathA = IIf(pathA = "H:\", "G:\", "N:\")
goto getPath
End If
pathB = pathA & "Backup\Backup_" & strLogin & "_"
pathCol = pathA & "Barry_Collier\Collier_Collection\"
pathLyn = pathA & "LYNDA\"
pathJpg = pathA & "Herbarium Database Storage\HERBARIUM DATABASE\DMHN COLLECTION DIGITAL SPECIMEN IMAGES\"
End Sub