DKDiveDude
Registered User.
- Local time
- Today, 09:31
- Joined
- Mar 28, 2003
- Messages
- 56
I am trying to make some code that will automatically create folders that do no exist, when saving a file.
I have something like this (simplified):
Function SaveFile(strFileName As String, strData As String)
On Error GoTo CreateFolder
Open strFileName for Output As #1
Print #1, strData
Close #1
Exit Function
CreateFolder:
Here is code to cut of filename, test and create folder one at a time
..
..
MkDir StrFolderTest
Resume Next
End Function
The problem is that if the path of strFolderTest does not exist, MkDir return an error that I can't trap, and the program exits.
Is that because I already trapped one error, I mean if I just do a simple function that will make a folder, I can trap it fine like this:
Function MakeFolder(strFolder As String)
On Error GoTo ErrorHandler
MkDir StrFolder
Exit Function
ErrorHandler:
Jadi, jadi, jadi
Resume Next
End Function
Obviously I am doing something wrong here, but what is the million dollar quesition.
Thanks
I have something like this (simplified):
Function SaveFile(strFileName As String, strData As String)
On Error GoTo CreateFolder
Open strFileName for Output As #1
Print #1, strData
Close #1
Exit Function
CreateFolder:
Here is code to cut of filename, test and create folder one at a time
..
..
MkDir StrFolderTest
Resume Next
End Function
The problem is that if the path of strFolderTest does not exist, MkDir return an error that I can't trap, and the program exits.
Is that because I already trapped one error, I mean if I just do a simple function that will make a folder, I can trap it fine like this:
Function MakeFolder(strFolder As String)
On Error GoTo ErrorHandler
MkDir StrFolder
Exit Function
ErrorHandler:
Jadi, jadi, jadi
Resume Next
End Function
Obviously I am doing something wrong here, but what is the million dollar quesition.
Thanks