第2个回答 2019-12-11
Option Explicit
Private Sub Command1_Click()
Dim strLine As String
Open App.Path & "/t.txt " For Input As #1
Do Until EOF(1)
Line Input #1, strLine
Text1.Text = Text1.Text & strLine & vbCrLf
Loop
Close #1
End Sub
Private Sub Text1_Change()
Dim name As String
Dim router As String
name = Text1.Text '把text文本的内容赋值给name
router = "D:\" & name
If Dir(router, vbDirectory) = "" Then '判断是否已经存在同名的文件夹
MkDir router
Else
MsgBox "D盘已经存在以" & name & "命名的文件夹!"
End If
End Sub
试试这个