求助在Dir1控件当前目录下新建一个文件夹的代码
求助在Dir1控件当前目录下新建一个文件夹的代码?
谢谢!
[解决办法]
MkDir Dir1.Path & "\新建文件夹"
[解决办法]
Option Explicit
Private Sub Command1_Click()
Dim i As Long, strPath As String
strPath = Dir1.Path & "\新建文件夹"
i = 1
If Dir(strPath, vbDirectory) > "" Then '2
Do Until Dir(strPath & i, vbDirectory) = ""
i = i + 1
Loop
End If
MkDir strPath & i
Dir1.Refresh '1
End Sub
Option Explicit
Private Sub Command1_Click()
Dim i As Long, strPath As String
strPath = Dir1.Path & "\新建文件夹"
i = 1
If Dir(strPath, vbDirectory) > "" Then '2
Do Until Dir(strPath & i, vbDirectory) = ""
i = i + 1
Loop
MkDir strPath & i
Else
MkDir strPath
End If
Dir1.Refresh '1
End Sub