VB代码解说

来源:百度知道 编辑:UC知道 时间:2024/09/18 06:37:38
Private Sub cmdCopy_Click()
Dim Files() As String
Dim Path As String
Dim i As Long, n As Long

Path = Dir1.Path
If Right(Path, 1) <> "\" Then
Path = Path & "\"
End If
请问以上的代码意思是什么?请一句句的解释下!谢谢哦!

Private Sub cmdCopy_Click()
Dim Files() As String
Dim Path As String
Dim i As Long, n As Long

Path = Dir1.Path '取得Dir中的路径
If Right(Path, 1) <> "\" Then 判断Path的最后一个字符是不是"\",如果不是"\",则执行IF...END 间的代码.
Path = Path & "\" 在Path字符串后面加反斜杠"\"
End If