Is there a way to intercept the SaveAsDialog or GetSaveFolderItem dialog? Here’s the scenario…
The user wants to save the contents of a window into a semi-formatted text file. If I use the dialogs above, the user can save to a new file. But if the file already exists, the OS (Windows in this case) puts up a ‘File exists. Do you want to replace it?’ dialog. Here is where I want to intercept the operation because the user wants the application to allow the creation of a new file or to append the new data to the existing file. (They would also like to optionally replace the original file but agree that they could delete the original manually outside the program.)
I know I could write an entire new SaveFile routine using my own dialogs and bypassing the OS but would rather not unless I have to.
If you want a different ‘new’ file then you need to give it a new name “myFile.1” myFile.2" YOu can’t have your old file, give a new one the same name, and keep both. Instead of trying to fight the OS, let it work for you.
Maybe I misunderstand your intent because I’m having trouble grasping the problem.
[quote=112150:@Dale Arends]I know I could write an entire new SaveFile routine using my own dialogs and bypassing the OS but would rather not unless I have to.
[/quote]
I am afraid you have no other choice if you want to avoid the “File already exist” dialog from the system. But be aware that in a sandboxed app, you must go through the official FileSave dialog to get permission to write to the file anyway.
Roger’s right, here’s another way to look at it.
The Save As dialog is specifically meant to replace a file, so really you’re mixing your metaphors. Users expect that, so really this is a Interface Guidelines issue.
If you’d like to give the option to modify a file, you should give the user a Open dialog to select the file they want modified.
Perhaps a solution would be a MsgBox that says Overwrite or Merge. Overwrite would Save As, and Merge would Open and you’d do the merging and saving yourself after the dialog returns.
I know you are looking for a CombinedDialog which doesn’t seem to be a bad idea, but the Interface Bosses don’t seem to see the need for it, perhaps they know better.
I considered that approach also. It seems to be the way I’ll have to take it. I was just hoping that there was a means to the end that I had forgotten about.
Ah, well. If it were easy …