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: ";

CodePudding user response:

reference 1st floor milaoshu1020 response:
string array class variables or 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: ";

The great spirit can add my qq? I have a question hope to solve the 1198745180

CodePudding user response:

reference 1st floor milaoshu1020 response:
string array class variables or 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: ";

Just want to ask why, files (a) save any address can only save the file name

CodePudding user response:

Can save address:
Files (a)=path & amp; SPath
Change
Files (a)=folder_name & amp; SPath
Should be ok.
  • Related