首页 /编程语言和算法/VB6/VBA/ASP
 VB6 重命名语句 Name oldFileName As newFileName
昨天 23:33
Private Sub RenameFileUsingName()
    Dim oldFileName As String
    Dim newFileName As String
    
    ' 设置要重命名的源文件和目标文件名
    oldFileName = "C:\path\to\your\oldfile.txt"
    newFileName = "C:\path\to\your
ewfile.txt"
    
    ' 使用 Name 语句重命名文件
    On Error GoTo ErrorHandler
    Name oldFileName As newFileName
    MsgBox "文件重命名成功!"
    Exit Sub

ErrorHandler:
    MsgBox "文件重命名失败: " & Err.Description
End Sub


 
全部回复(0)
首页 | 电脑版 |