可以使用MkDir函数逐层目录的创建,即:先创建文件夹:1 再创建文件夹 2大致如下: Private Sub Command1_Click() Dim strP As String Dim intP As Integer intP = 1 strP = "D:\1" Do MkDir strP intP = intP + 1 strP = strP & "\" & CStr(intP) Loop Until intP > 10 End Sub只是不知道Windows系统的文件夹系统允许多少层,可能不会有一百层吧
Option Explicit Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal DirPath As String) As LongPrivate Sub Command1_Click() MakeSureDirectoryPathExists "c:\0\1\2\3\4\5\6\7\8\9" MsgBox "建立完成!" End Sub
Private Sub Command1_Click()
Dim strP As String
Dim intP As Integer
intP = 1
strP = "D:\1"
Do
MkDir strP
intP = intP + 1
strP = strP & "\" & CStr(intP)
Loop Until intP > 10
End Sub只是不知道Windows系统的文件夹系统允许多少层,可能不会有一百层吧
Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal DirPath As String) As LongPrivate Sub Command1_Click()
MakeSureDirectoryPathExists "c:\0\1\2\3\4\5\6\7\8\9"
MsgBox "建立完成!"
End Sub