zz? =? InputBox ("Please enter the changed folder name:",? "Hello"? zz)
For what? Me? =? Len(Dir 1。 List (Dir 1. ListIndex))? Where to? 1? One step? - 1
What if? Mid(Dir 1。 List (Dir 1. ListIndex),? Me? 1)? =? "\"? then
sss? =? Left (Dir 1. List (Dir 1. ListIndex),? I)
Me? =? 0
End? if
Next? I
sss? =? sss? & amp? zigzag
Name? Dir 1。 List (Dir 1. ListIndex)? As? Selective military service system
Because you used Dim? zz,? sss? As? String defines zz as a string variable, and str function converts the plastic variable into a string. Of course, the string does not need to be converted, so it can be used directly.
The inputbox function returns a string type.
There is also an exception when there is no dir 1 and the listindex is-1.
Can be used at the beginning of the process. Open? Mistakes? Resume? The next statement will continue to execute when an exception occurs, otherwise the box will collapse directly.
On the code side? Add the following code before sub to prompt information about the exception.
What if? err.number & gt0? then
MsgBox? Error number: "? +? Str(Err。 Number)? +? "Hint:"+? Uh ... Description,? VB exclamation point
End? if
When an error occurs, as shown in the figure.