Search Tools Links Login

Create Dir (Folder)


Visual Basic 6, or VB Classic

this code creates folder with any number of subfolders beneath it. MkDir can't do this!
sorry 4 my english :)

Original Author: Bibikoff Leonid

Inputs

Path as string

Assumptions

paste this code in new module
in immediate window type for example
CreateDir "c: rrgggjjjkkk"

Code

Sub CreateDir(strPath As String)
On Error Resume Next
Dim ArrFolders As Variant
ArrFolders = Split(strPath, "")
dim i as long
Dim CurPath As String: CurPath = ArrFolders(0)
MkDir CurPath
For i = 1 To UBound(ArrFolders)
  CurPath = CurPath & "" & ArrFolders(i)
  MkDir CurPath
Next i
On Error GoTo 0
If Len(Dir(strPath, vbDirectory)) = 0 Then
  Err.Raise vbObjectError, , "Can't create dir" & vbCrLf & strPath & vbcrlf & ":(((("
End If
End Sub

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 109 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.