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

Time:09-22

 Option Explicit 

Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp. DLL" (ByVal DirPath As String) As Long

Private Sub Command1_Click ()
Path of 'attention to \ end, check the code to write their own'
MakeSureDirectoryPathExists Text1. Text
End Sub


The above in
Exclude what is going on
Can you answer all of the code,

CodePudding user response:

The mkdir
Build folder, baidu,

CodePudding user response:

About the code, please refer to:
 Option Explicit 
Sub test ()
Dim w1 As String
W1=CreatePath (Text1. Text)
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:

Looking at this code is no problem, a few years ago would have seen such application code,


I tried to use it to create two levels of folder does not exist, are also creating a success,
E: \ code \ T1, T2,
Path in e: \ code is already exist, T1, T2 is not exist, after the operation to create successful,

The building Lord you said "no", it is there any error message, to what's going on!!!!!!

CodePudding user response:

My system: Windows 7 SP1 flagship edition, 64

VB6 is simplified Chinese enterprise edition,


The code is run under VB6 IDE,

CodePudding user response:

Is my VB code to create content using the ext named multistage folder code how to write
The code itself is not a problem,

You enter the wrong path?
In the higher level directory without permission?
Was blocked by the antivirus software?
  • Related