Cancel returns the text string "False". Here is an amended version of Pascal's
code:
Sub AAAAA()
Dim mywb As Workbook, retval
retval = Application.Dialogs(xlDialogOpen).Show
If retval = "False" Then
MsgBox "Cancelled by user"
Exit Sub
End If
Set mywb = ActiveWorkbook
End Sub