Trigger for Cancel button in CommonDialog
Posted on 1998-12-22
In the Programmers Guide I find this example for the CommonDialog control, when opening a file from the Open dialog:
Private Sub mnuFileOpen_Click()
' CancelError is True.
On Error Goto ErrHandler
' User pressed Cancel button.
However, this doesn't work for me. Here's my code:
On Error GoTo Hell
CommonDialog1.Filter = "Text Files (*.txt)|*.txt"
CommonDialog1.FilterIndex = 2
sFile = CommonDialog1.filename
The code stops, as usual, after the .ShowOpen call, but then it _continues_ even if I pressed the Cancel button. Is it any other way to know when the user pressed the button?