|
-
May 20th, 2003, 12:02 AM
#1
Thread Starter
Member
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
Thanks for reading my post!
-
May 20th, 2003, 12:44 AM
#2
-= B u g S l a y e r =-
is the file you try to rename in use ?
if so, an error will occur when you try to rename it. you are using error handler that only exits the sub assuming the only error that can occur is the cancel error....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|