Adding Options to The File Save As Dialog Box
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I have the following function that opens the File "Save As" dialog box. It gets fed a drawing number and allows the users to browse to a folder where they want to save it. The problem is when a file already exists with the same name. A message box pops up letting the user know that the file already exists and do they want to overwrite it. The can pick yes to overwrite, but it doesn't really overwrite the old file, it seems like it opens it and then crashes when the rest of the program tries to run.
What I want to do is create a loop to determine if the file already exists. If it does not exist, then save the path and drawing name as usual.
If the drawing exists, I want to pop up a dialog giving two options; Overwrite, or Rename the current drawing. If they pick Overwrite, I can have the program delete the old existing drawing and then just save this one. If they pick Rename it will loop back to the "Save As" dialog giving the user the ability to change their drawing name (like add a "-1" to it.
Any help will be greatly appreciated.
Best regards,
Mark
Public Function GetFilePathAndName(ByVal dwgNumber)
podDWG = ApplicationServices.Application.DocumentManager.MdiActiveDocument
podDB = podDWG.Database
podEd = podDWG.Editor
podPSO.InitialDirectory = "W:\Work_in_Process"
podPSO.InitialFileName = dwgNumber
podPSO.Filter = "AutoCAD DWG Files|*.dwg"
podPFR = podEd.GetFileNameForSave(podPSO)
Select Case podPFR.Status
Case EditorInput.PromptStatus.OK
SaveDwgName = podPFR.StringResult
Case EditorInput.PromptStatus.Cancel
MsgBox("User Cancelled.")
End Select
Return SaveDwgName
End Function