Name Statement

Thay đổi tên của một tập tin hoặc thư mục đã có.

Cú pháp:


Name OldName As String As NewName As String

Tham số :

OldName, NewName: bất cứ biểu thức chuỗi nào mà ghi rõ tên tập tin (chứa đường dẫn). Bạn cũng có thể dùng kiểu ghi URL.

Thí dụ :


Sub ExampleReName
On Error GoTo Error
FileCopy "c:\autoexec.bat", "c:\temp\autoexec.sav"
Name "c:\temp\autoexec.sav" As "c:\temp\autoexec.bat"
End
Error:
If err = 58 Then
    msgbox "Tập tin đã có"
End If
End
End Sub

Please support us!