{"id":3061,"date":"2022-06-01T01:00:08","date_gmt":"2022-05-31T16:00:08","guid":{"rendered":"http:\/\/anada.cloudfree.jp\/?p=3061"},"modified":"2022-05-20T13:34:22","modified_gmt":"2022-05-20T04:34:22","slug":"excelvba%e8%a6%9a%e6%9b%b8-on-error-%e3%82%a8%e3%83%a9%e3%83%bc%e7%99%ba%e7%94%9f%e5%be%8c%e3%81%ae%e3%82%a8%e3%83%a9%e3%83%bc","status":"publish","type":"post","link":"http:\/\/anada.cloudfree.jp\/?p=3061","title":{"rendered":"ExcelVBA\u899a\u66f8 On Error \u30a8\u30e9\u30fc\u767a\u751f\u5f8c\u306e\u30a8\u30e9\u30fc"},"content":{"rendered":"<p>VBA\u306e\u4f8b\u5916\u51e6\u7406\u306e\u8a71\u3002<br \/>\nJava\u3084C#\u3068\u304b\u3060\u3068\u3001Try-Catch\u306eCatch\u306e\u4e2d\u3067\u306e\u30a8\u30e9\u30fc\u306b\u3064\u3044\u3066\u306f\u3001Catch\u5185\u306b\u3055\u3089\u306bTry-Catch\u3092\u5165\u308c\u308b\u3068\u3044\u3046\u624b\u6cd5\u3092\u53d6\u308b\u3068\u601d\u3046\u306e\u3060\u3051\u308c\u3069\u3001VBA\u306b\u306a\u308b\u3068\u3001\u5c11\u3005\u3081\u3093\u3069\u304f\u3055\u3044\u3002\u3044\u3084\u304b\u306a\u308a\u3081\u3093\u3069\u304f\u3055\u3044\u8a71\u306b\u306a\u308b\u3002<\/p>\n<p><a href=\"http:\/\/club-vba.tokyo\/vba-error-second-time\/\" rel=\"noopener\" target=\"_blank\">\u30d6\u30a4\u30b5\u30d0\u3010Excel VBA\u30b5\u30d0\u30a4\u30d0\u30eb\u3011\uff5e\u3068\u308a\u3042\u3048\u305a\u3053\u3053\u306b\u6765\u308c\u3070\u89e3\u6c7a\u3067\u304d\u308b\uff5e\u300eVBA\uff5c\u30a8\u30e9\u30fc\u51e6\u7406\u3092\uff12\u56de\u76ee\u4ee5\u964d\u3082\u51e6\u7406\u3067\u304d\u308b\u65b9\u6cd5\u300f<\/a><\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u3044\u304f\u3068\u3001VBA\u306e\u4f8b\u5916\u51e6\u7406(On Error\u6587)\u3067\u6c17\u3092\u3064\u3051\u3066\u304a\u304b\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3053\u3068\u304c\u3042\u308b\u3088\u3046\u3060\u304c\u3001<br \/>\n\u7aef\u7684\u306b\u8a00\u3048\u3070\u3001\u4e0b\u306e\uff12\u3064\u306e\u3053\u3068\u3092\u8003\u616e\u3059\u308b\u3068\u3088\u3044\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308b\u3002<\/p>\n<ol>\n<li>\u30a8\u30e9\u30fc\u51e6\u7406\u4e2d\u306e\u30a8\u30e9\u30fc\u306f\u30c8\u30e9\u30c3\u30d7\u3055\u308c\u306a\u3044\u30e8<\/li>\n<li>\u3068\u306f\u3044\u3048\u3001<big>Resume<\/big>\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3067\u3001\u4ed5\u5207\u308a\u76f4\u3057\u3067\u304d\u308b\u3093\u3060\u3088<\/li>\n<\/ol>\n<p>\u3068\u3044\u3046\u306e\u3067\u5b9f\u8df5\u7de8\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\nSub Sample1   \r\n    On Error Goto ErrLabel1\r\n    *** \u30a8\u30e9\u30fc\u767a\u751f(1) ***\r\n    Exit Sub\r\nErrLabel1:\r\n    MsgBox &quot;No.&quot; &amp; Err.Number &amp; Err.Description , &quot;Error&quot;\r\n    Resume ErrLabel2    '\u2190\u2190\u2190\u2190\u30b3\u30b3\u3067\u4ed5\u5207\u308a\u76f4\u3057!!\r\nErrLabel2:\r\n    On Error Resume Next\r\n    *** \u30a8\u30e9\u30fc\u767a\u751f(2) ***\r\nEnd Sub\r\n<\/pre>\n<p>\u307e\u305a\u306f\u300cOn Error Goto ErrLabel1\u300d\u3067\u4f8b\u5916\u51e6\u7406\u3078\u30b9\u30ad\u30c3\u30d7\u3059\u308b\u51e6\u7406\u3092\u5165\u308c\u308b\u3002<br \/>\n\u30a8\u30e9\u30fc\u767a\u751f(1)\u306e\u7b87\u6240\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u3068\u3001ErrLabel1\u30e9\u30d9\u30eb\u306b\u98db\u3076\u3002<br \/>\n\u30a8\u30e9\u30fc\u3092\u8868\u793a\u3055\u305b\u305f\u5f8c\u306e\u300cResume ErrLabel2\u300d\u3068\u3044\u3046\u3068\u3053\u308d\u304c\u4ed5\u5207\u308a\u76f4\u3057\u306e\u7b87\u6240\u3002<br \/>\n\u306a\u306e\u3067\u3001Err\u3092\u30a6\u30a9\u30c3\u30c1\u3059\u308b\u3068\u3001\u300cResume ErrLabel2\u300d\u306e\u7b87\u6240\u3067\u306f\u30a8\u30e9\u30fcNo\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u304c\u3001ErrLabel2\u30e9\u30d9\u30eb\u4e0b\u306e\u300cOn Error Resume Next\u300d\u306e\u884c\u306b\u306a\u308b\u3068\u3001\u30a8\u30e9\u30fc\u306f\u30af\u30ea\u30a2\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<p>\u3088\u3063\u3066\u3001ErrLabel2\u4ee5\u964d\u3067\u3001\u518d\u5ea6\u30c8\u30e9\u30c3\u30d7\u53ef\u80fd\u306aOn Error\u6587\u3092\u6307\u5b9a\u3057\u3066\u3042\u3052\u308c\u3070\u3088\u3044\u3002<br \/>\n\uff08\u3053\u3053\u3067\u306fResume<br \/>\nNext\u306b\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u30a8\u30e9\u30fc\u304c\u3042\u308b\u3068\u6b21\u884c\u3078\u9032\u3080\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\uff09<\/p>\n<p>\u56e0\u307f\u306b\u3001\u3053\u3046\u3044\u3046\u3053\u3068\u3092\u3084\u3089\u305a\u306bErr.Clear\u3068\u304b\u3057\u3066\u307f\u305f\u3089\u3069\u3046\u306a\u308b\u306e\u304b\u8a66\u3057\u305f\u306e\u3060\u304c\u3001\u3053\u308c\u3060\u30682\u3064\u76ee\u306e\u30a8\u30e9\u30fc\u306f\u30c8\u30e9\u30c3\u30d7\u3055\u308c\u306a\u304b\u3063\u305f\u3002<br \/>\n\u3093\u3058\u3083\u3041\u3001Resume\u3058\u3083\u306a\u304f\u3066\u3001Goto\u3060\u3063\u305f\u3089\uff1f\u3068\u3084\u3063\u3066\u307f\u305f\u304c\u3001\u3053\u306e\u5834\u5408\u306fErr\u306b\u305d\u306e\u307e\u307e\u30a8\u30e9\u30fc\u60c5\u5831\u304c\u6b8b\u3063\u305f\u72b6\u614b\u3067\u3001ErrLabel2\u306b\u98db\u3093\u3067\u3044\u305f\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001<big>\u300cResume \u30e9\u30d9\u30eb\u540d\u300d<\/big><br \/>\n\u9762\u5012\u3060\u304c\u3053\u3046\u3044\u3046\u624b\u3092\u4f7f\u308f\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VBA\u306e\u4f8b\u5916\u51e6\u7406\u306e\u8a71\u3002 Java\u3084C#\u3068\u304b\u3060\u3068\u3001Try-Catch\u306eCatch\u306e\u4e2d\u3067\u306e\u30a8\u30e9\u30fc\u306b\u3064\u3044\u3066\u306f\u3001Catch\u5185\u306b\u3055\u3089\u306bTry-Catch\u3092\u5165\u308c\u308b\u3068\u3044\u3046\u624b\u6cd5\u3092\u53d6\u308b\u3068\u601d\u3046\u306e\u3060\u3051\u308c\u3069\u3001VBA\u306b\u306a\u308b\u3068\u3001\u5c11\u3005\u3081\u3093\u3069\u304f\u3055\u3044\u3002\u3044 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-3061","post","type-post","status-publish","format-standard","hentry","category-excelvba"],"_links":{"self":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts\/3061","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3061"}],"version-history":[{"count":3,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts\/3061\/revisions"}],"predecessor-version":[{"id":3064,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=\/wp\/v2\/posts\/3061\/revisions\/3064"}],"wp:attachment":[{"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3061"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3061"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/anada.cloudfree.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3061"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}