Click to See Complete Forum and Search --> : Detecting clicking the Cancel Button using common dialog controls


HerickPaiva
April 25th, 2001, 10:09 AM
Hi,

I want to exit a sub if a user hits the cancel button in a save/open dialog. How do I do it????

F.Mayis
April 25th, 2001, 11:25 AM
you use CommonDialiog.ShowOpen function to display your dialog?

if yes, just after the call to ShowOpen test if
CommonDialog.FileName = ""
if yes it's because cancel have been pressed or because the user has exited the dialog without selecting a file.

Dark Sean
April 25th, 2001, 12:16 PM
Set the cancelerror to true, and then add code for exiting the sub on your on error goto...

John G Duffy
April 25th, 2001, 02:06 PM
CommonDialog1.CancelError = true
CommonDialog1.ShowOpen
If Err.Number <> 0 then Exit Sub





John G