Home > Software engineering >  Vb use TEXT1 to establish multiple files
Vb use TEXT1 to establish multiple files

Time:09-22

Vb use TEXT1 input named multistage folder name

CodePudding user response:

Didn't understand what meaning,
Is the MKDIR build folder

CodePudding user response:

About the code, please refer to:
 Option Explicit 
Sub test ()
Dim w1 As String
W1=CreatePath (" d: \ fg/fg/fg ")
If w1 & lt;> "" Then MsgBox w1
End Sub
The Function CreatePath (ByVal bPath As String) As String
CreatePath="please enter the correct path." ' ' ' 'to a default error message
BPath=Trim (bPath)
If Len (bPath)=0 Then the Exit Function
BPath=bPath & amp; ""
On Error GoTo incremented
Dim s1 As String, I As an Integer, s2 As String, pp
Pp=Split (bPath, "")
If UBound (pp) & gt; 1 Then
S1=pp (0)
For I=1 To UBound (pp) - 1
S2=Trim (pp (I))
If s2="" Then Exit Function
S1=s1 & amp; "" & amp; S2
If Dir $(s1, vbDirectory)="" Then MkDir s1
Next
End the If
CreatePath=""
The Exit Function
Is incremented:
CreatePath=Err. The Description
End the Function


.

CodePudding user response:



Your another post, the code should be "right",
You say "no", what's wrong with your input?
There is any authority within the "target folder" to create a new folder?
  • Related