Hello everyone! I am using Microsoft Visual Basic 6. How do I exit the sub when the "Cancel" button is clicked in the CommonDialog? Thank you!
Printable View
Hello everyone! I am using Microsoft Visual Basic 6. How do I exit the sub when the "Cancel" button is clicked in the CommonDialog? Thank you!
Code doc(a member's username with a black bear as the avatar) has some code for using common dialog control. He had posted it in some of the previous threads. Search the forum for his code...
Good day, pal...:)
You have to set CancelError to True:
Code:Private Sub Command1_Click()
On Error GoTo ErrHandler
With CommonDialog1
.CancelError = True '<<< this is the key
.ShowOpen
'...
End With
Exit Sub
ErrHandler:
Err.Clear
Exit Sub
End Sub
Thank you!:DQuote:
Originally Posted by RhinoBull