atunplatino
Technical User
Hello I am using VB6 and am trying to use the Common Dialog control to allow my user to name a file that the program is creating. The trouble is I cannot figure out how to generate an alert to the user if they have selected a filename that is already taken and are thus about to overwrite an existing file. Can anybody help me??
Here is some of my code:
___________________________________________
cdlCommon.CancelError = False
cdlCommon.InitDir = App.Path & "\pictures\"
cdlCommon.FileName = Format(Now, "mm-dd-yyyy")
cdlCommon.Flags = cdlOFNHideReadOnly
cdlCommon.Filter = "Picture Files (*.jpg)|*.jpg|"
cdlCommon.FilterIndex = 1
cdlCommon.ShowSave
Dim newpic As String
newpic = cdlCommon.FileName
'USE FSO TO CREATE THE FILE REQUESTED ABOVE
Dim fs, A As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Set A = fs.createtextfile(newpic, True)
A.Close
_________________________________________
Again, the code is fully functional I just need to know how to generate an alert for the user if an existing file name is about to be overwritten.
Thank you very much.
-Atunplatino
Here is some of my code:
___________________________________________
cdlCommon.CancelError = False
cdlCommon.InitDir = App.Path & "\pictures\"
cdlCommon.FileName = Format(Now, "mm-dd-yyyy")
cdlCommon.Flags = cdlOFNHideReadOnly
cdlCommon.Filter = "Picture Files (*.jpg)|*.jpg|"
cdlCommon.FilterIndex = 1
cdlCommon.ShowSave
Dim newpic As String
newpic = cdlCommon.FileName
'USE FSO TO CREATE THE FILE REQUESTED ABOVE
Dim fs, A As Object
Set fs = CreateObject("Scripting.FileSystemObject")
Set A = fs.createtextfile(newpic, True)
A.Close
_________________________________________
Again, the code is fully functional I just need to know how to generate an alert for the user if an existing file name is about to be overwritten.
Thank you very much.
-Atunplatino