CommonDialog Save as, and renaming files
Please help me with my code.
I'm not sure why it's not working.
What I'm doing is showing the GetSaveAs dialog box. I'm trying to rename newfile to a different filename, which is a filename entered by the user in the Save as dialog box.
However, if the user selects a file which already exists, this code doesn't work. It doesn't rename it. How should I go about this? Any ideas?
Code:
Private Sub SaveFile()
On Error GoTo UserCanceled
CommonDialog1.Flags = cdlOFNOverwritePrompt
CommonDialog1.Filter = "Excel Spreadsheets| *.xls"
CommonDialog1.CancelError = True '<when they press cancel it makes an error
CommonDialog1.InitDir = lstDirListBox.Path
CommonDialog1.ShowSave
Name newfile As CommonDialog1.FileName
Exit Sub
UserCanceled:
End Sub