本帖最后由 linzaixuan003 于 2009-11-27 00:25:01 编辑

解决方案 »

  1.   

    属性 CancelError=true
    On Error GoTo Err:
    dlg.ShowOpen
    Err:
    If Err.Number <> 0 Then MsgBox "a"
      

  2.   

    同楼上.sub XXXXX()
        on error goto ErrHandle    CommonDialog1.cancelerror=true     '设置为T后,如果按了取消将产生cdlCancel错误
        commondialog1.showopen    msgbox commondialog1.filename    exit suberrhandle:
        if err.number<>cdlCancel then msgbox err.description   '只要是cdlCancel错误,就说明是按了取消.
    end sub
      

  3.   

    可能是你的CommonDialog1 比我的 dlg长吧