Click to See Complete Forum and Search --> : CommonDialog


Eric Millaud
March 22nd, 2001, 03:06 AM
Hi
Anyone can tell me how i can know when a cancel button has been clicked when i open a CommonDialog ?
Thanks

vin
March 22nd, 2001, 03:16 AM
There is a property of commondialog:

cancelerror

when it is set to true you get error when user press cancel.

use onerror goto to trap this situation



Valery Iskarov Nikolov
http://listen.to/quark

Iouri
March 22nd, 2001, 07:12 AM
Just to add to vin comment

Use the CancelError property to trigger a trappable error if cancel is selected, i.e.


private Sub Command1_Click()
on error GoTo Cancelled
With CommonDialog1
.CancelError = true
.ShowSave
'Save Code Here
End With
MsgBox "File Saved.", vbInformation + vbOKOnly, "Saved."
Cancelled:
End Sub



Iouri Boutchkine
iouri@hotsheet.com