The following code is being used to generate folders across a local network. The application is running on a box that is hooked via wireless connection (54Mbs) to a 100M Wired network ... the box we are talking to has a shared folder ... both machines are running XP Pro SP3. The problem that has started to occur is FolderExists appears to be timing out intermittently which causes the code to believe the folder doesn't exist ... this in turn fires off the CreateFolder request which if the folder does exist generates the "FILE EXISTS" error.
Is there some other Metric that can be utilized to determine if a FileSystemObject request was completed properly?
Public Function MakeFolder(stFolder As String) As Boolean
On Error GoTo ErrMakeFolder
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
MakeFolder = fs.FolderExists(stFolder)
If Not MakeFolder Then
MakeFolder = NOT (stFolder = fs.CreateFolder(stFolder))
EndIf
MakeFolder = True
Exit Function
ErrMakeFolder:
Call ErrMsg("MakeFolder " & Err.Description)
MakeFolder = False
End Function
Is there some other Metric that can be utilized to determine if a FileSystemObject request was completed properly?
Public Function MakeFolder(stFolder As String) As Boolean
On Error GoTo ErrMakeFolder
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
MakeFolder = fs.FolderExists(stFolder)
If Not MakeFolder Then
MakeFolder = NOT (stFolder = fs.CreateFolder(stFolder))
EndIf
MakeFolder = True
Exit Function
ErrMakeFolder:
Call ErrMsg("MakeFolder " & Err.Description)
MakeFolder = False
End Function