|
-
Jan 23rd, 2003, 01:05 AM
#1
Thread Starter
Hyperactive Member
URGENT: Creating Folders in MAC OS X through VB6
hi,
I ' ve made an application to create a folder in MAC OS X through vb. But when i run that application it gives me an error folder can not be created. ny idea whats wrong in the application. I m pasting the code below:
Private Sub cmdOK_Click()
Dim fs As FileSystemObject
Dim s As Boolean
Dim msg As String
Dim rep As String
If txtUserName.Text = "" Then
MsgBox "Please fill in your username."
txtUserName.SetFocus
Exit Sub
End If
studentName = txtUserName.Text
s = False
Set fs = New FileSystemObject
'make path as per the server and student name
path = path & "\" & studentName
MsgBox "Student File Path is : " & vbCrLf & path, vbInformation + vbOKOnly, "Student File Path"
s = fs.FolderExists(path)
If s = False Then 'if the folder does not exist then
On Error Resume Next
fs.CreateFolder (path)
'MkDir (path) 'create the folder
If Err Then
MsgBox "Error #1 Folder - 'Name' can not be created" & vbCrLf & Err.Description, vbCritical + vbOKOnly, "First Draft Client"
End
Else
MsgBox "Step : 3 Completed Sucessfully." & vbCrLf & " 'Name' folder created", vbInformation + vbOKOnly, "First Draft Client"
End If
End If
'initialize currDate to current date in string format
currDate = Date$
'path where all files will be stored
'path is based on the server name, student name and the current date
path = path & "\" & currDate
'make a sub-directory (date) within the main directory (studentName)
s = fs.FolderExists(path)
If s = False Then
On Error Resume Next
fs.CreateFolder (path)
'MkDir (path) 'create the folder
If Err Then
MsgBox "Error #2 Folder - 'Date' can not be created" & vbCrLf & Err.Description, vbCritical + vbOKOnly, "First Draft Client"
End
Else
MsgBox "Step : 4 Completed Sucessfully." & vbCrLf & " 'Date' folder Created", vbInformation + vbOKOnly, "First Draft Client"
End If
Else
msg = "You have used this application earlier today." & vbCrLf & "If you continue, any work that you saved today will be deleted. Do you want to continue?"
If MsgBox(msg, vbOKCancel + vbCritical, "Warning") = vbOK Then
If fs.FileExists(path & "\report.rtf") Then
On Error Resume Next
Kill (path & "\*.*")
If Err Then
MsgBox "Error #3 Files can not be deleted", vbCritical + vbOKOnly, "First Draft Client"
End
End If
End If
Else
path = initPath 'initialize path back to the contents of the file
Exit Sub
End If
End If
'step 3 completed
MsgBox "Folders created. Step 5 completed successfully!", vbInformation, "Steps"
frmMain.Show
Unload Me
'errHandler: 'function to handle errors
' If Err.Number <> 0 Then 'if an error has occured
' MsgBox Err.Number & " " & Err.Description, , "Error"
' path = initPath 'initialize path back to the contents of the file
' End If
End Sub
Please its very urgent....
Anjani
A man with nothing to live for has everything to fight for...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|