In my program, the user can click a command button to save information which is being displayed in a text box. The file name is also provided by the user in another text box called FileName. I want to be able to detect the file and if it exists, a message box will pop up asking the user if they want to overwrite the existing file or cancel. I can get the file detected but it still saves. Any ideas?
Private Sub cmdFile_Click()
Dim i As Integer
Open FileName For Output Access Write As #1
If Dir(FileName) <> vbNullString Then
Error = MsgBox("This File Already Exists, Over Write?", vbYesNo, "File Error")
0 · ·