The following code is an attempt to use CommonDialog1 to save a word file. My question is -
If I save a word file named report.doc (and this file name already exists in a directory), then the CommonDialog1 will prompt a warning message about overwriting the report.doc file. But if I save a word file named report (again, the file report.doc already exists in a directory), then the CommonDialog1 will NOT prompt any warning message. As a result, the report.doc will be overwritten. How do you modify the code so that the report.doc won't be overwritten?
Private Sub Form_Load()
Dim wordFileName As String
wordFileName = ""
CommonDialog1.Filter = "Word Files (*.doc)"
CommonDialog1.FilterIndex = 1
CommonDialog1.Flags = cdlOFNOverwritePrompt
CommonDialog1.FileName = ""
wordFileName = CommonDialog1.FileName
MsgBox "file name is " & wordFileName