by Brandon (46 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 18th January 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Prompt a user to rename a file thats on your desktop.
On Error GoTo Exception_Handler:
Dim PreviousFileName, NewFileName As String
PreviousFileName = "C:\Windows\Desktop\File1.txt"
NewFileName = InputBox("What do you wish to rename " & PreviousFileName & "?", "Rename File")
NewFileName = "C:\Windows\Desktop " & "\" & NewFileName & ".txt"
Name PreviousFileName As NewFileName
Exit Sub
Exception_Handler:
MsgBox Err.Description, vbCritical, "Error"