Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
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")