Home > Software engineering >  Consult the scripting. Filesystemobject circulation problems
Consult the scripting. Filesystemobject circulation problems

Time:09-30


Folder only D: \ CG \ 2. DWG, D: \ CG \ 3. DWG, D: \ CG \ Drawing1 DWG these three document

Code:
The Set scr_obj=CreateObject (" scripting. Filesystemobject ")
The Set folder_obj=scr_obj. GetFolder (Text2. Text)
The Set files_obj=folder_obj. Files
Num=0
For Each file In files_obj

If Right (the file Name, 3)="DWG" Then "whether for DWG
.
The Debug. Print file. The Path
Num=num + 1
End the if
Next
Found sometimes cycle the three files, or repeated a file, why?
Results:
* * * * * * * * * * * * * * * *
D: \ \ 2 CG. DWG
D: \ CG \ 3. DWG
D: \ CG \ Drawing1 DWG
* * * * * * * * * * * * * * * *
D: \ CG \ 3. DWG
D: \ CG \ Drawing1 DWG
D: \ \ 2 CG. DWG
D: \ CG \ 3. DWG
* * * * * * * * * * * * * * * *

CodePudding user response:

haven't met,

CodePudding user response:

A) search the Debug the whole project. The first Print, confirmed only output filename here,
B) do you use the output of the previous debugging as this time? The output window delete clean test again,

CodePudding user response:

refer to the second floor Tiger_Zhao response:
A) search the Debug the whole project. The first Print, confirmed only output filename here,
B) do you use the output of the previous debugging as this time? Delete clean test again, the output window

CodePudding user response:

Surveillance files_obj,
Run step by step, try twice more, look at the problem appeared, files_obj content
  • Related