就是点击,根据船名航次,建一个
Private Sub Command74_Click()
Dim Rs As ADODB.Recordset
Dim s As String
Set Rs = New ADODB.Recordset
Rs.Open "文件夹", CurrentProject.Connection.ConnectionString, adOpenKeyset, adLockOptimistic
Rs.MoveFirst
Do Until Rs.EOF
s = "\\192.168.1.75\共享\共享\业务文件\单船\" & Rs(3)
MakeDir s
Rs.MoveNext
Loop
Set Rs = Nothing
End Sub
Public Function MakeDir(sPath As String)
If Dir$(sPath, vbDirectory) = "" Then
MkDir (sPath)
End If
End Function
'在当前位置新建文件夹
Sub 新建文件夹()
On Error GoTo 错误
Dim folderName, folderPath As String
'获取新建文件夹的名称,默认为“新建文件夹”
folderName = InputBox("请输入文件夹的名称", "文件夹名", "新建文件夹")
'设置新建文件夹的路径
folderPath = CurrentProject.Path & "\" & folderName
'新建文件夹
MkDir folderPath
Exit Sub
错误: MsgBox Err.Description
End Sub
Private Sub Command74_Click()
On Error GoTo 错误
Dim folderName, folderPath As String
folderName = Me.Text78
folderPath = "
\\192.168.1.75\共享\共享\业务文件\单船\" & "\" & folderName
MkDir folderPath
Exit Sub
错误: MsgBox "该文件夹已存在!"
End Sub