Home > Software engineering > Ask everyone a great god, and how the traverse the file of the program use
Ask everyone a great god, and how the traverse the file of the program use
Time:09-15
Public Sub Search_file_in_folder (folder_name As String) 'iterates through all the text of the specified folder file
Dim Files () As String
Dim As a Integer
FileType="* *"
SPath=Dir (folder_name & amp; FileType) 'to find the first file
The Do While Len (sPath) 'loop until no files
A=a + 1
ReDim Preserve Files To (1 a)
Files (a)=path & amp; SPath 'will file directory and file name, coexist in array
SPath find next file=Dir '
DoEvents' cede control
Loop
End Sub
CodePudding user response:
String array class variable or a global variable Files found a string array to save the results; Folder_name call when parameters of the string must end with "", such as "c: ";