{"id":776,"date":"2015-02-27T13:03:43","date_gmt":"2015-02-27T04:03:43","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=776"},"modified":"2015-03-22T19:50:09","modified_gmt":"2015-03-22T10:50:09","slug":"vba_msgbox","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/vba_msgbox\/","title":{"rendered":"\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u3092\u8868\u793a\uff08MsgBox\u95a2\u6570\uff09"},"content":{"rendered":"<h2>MsgBox\u95a2\u6570<\/h2>\n<br \/><br \/>\n<div class=\"m30-l\">\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><br \/>\n<em>result<\/em> = <strong>MsgBox<\/strong> ( <em>Prompt<\/em> [ <em>, Buttons, Title, Helpfile, Context<\/em> ] )\n<\/div>\n<h3>\u3010\u5f15\u6570\u3011<\/h3>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>Prompt&nbsp;\u30fb\u30fb\u30fb&nbsp;\u8868\u793a\u3059\u308b\u6587\u5b57\u5217<\/li>\n<li>Buttons&nbsp;\u30fb\u30fb\u30fb&nbsp;\u30dc\u30bf\u30f3\u306e\u7a2e\u985e\u30fb\u500b\u6570\u30fb\u30a2\u30a4\u30b3\u30f3\u306e\u30b9\u30bf\u30a4\u30eb\u7b49\uff08\u7701\u7565\u53ef\uff09<\/li>\n<li>Title&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;\u30c0\u30a4\u30a2\u30ed\u30b0\u30dc\u30c3\u30af\u30b9\u306e\u30bf\u30a4\u30c8\u30eb\u30d0\u30fc\u306b\u8868\u793a\u3059\u308b\u6587\u5b57\u5217\uff08\u7701\u7565\u53ef\uff09<\/li>\n<li>Helpfile&nbsp;\u30fb\u30fb\u30fb&nbsp;\u30d8\u30eb\u30d7\u30d5\u30a1\u30a4\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u540d\uff08\u7701\u7565\u53ef\uff09<\/li>\n<li>Context&nbsp;\u30fb\u30fb\u30fb&nbsp;\u30d8\u30eb\u30d7\u30c8\u30d4\u30c3\u30af\u306b\u6307\u5b9a\u3057\u305f\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u756a\u53f7\uff08\u7701\u7565\u53ef\uff09<\/li>\n<\/ul>\n<\/div>\n<h3>\u3010\u623b\u5024\u3011<\/h3>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>result&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;\u30e6\u30fc\u30b6\u30fc\u304c\u9078\u629e\u3057\u305f\u30dc\u30bf\u30f3\u306b\u5bfe\u5fdc\u3059\u308b\u5b9a\u6570<\/ul>\n<\/div>\n<br \/><br \/>\n<p class=\"caution3\">\u5f15\u6570 Prompt \u306b\u8907\u6570\u884c\u3092\u6307\u5b9a\u3059\u308b\u5834\u5408\u306f\u3001\u30ad\u30e3\u30ea\u30c3\u30b8\u30ea\u30bf\u30fc\u30f3\uff08Chr(13)\uff09\u3001\u30e9\u30a4\u30f3 \u30d5\u30a3\u30fc\u30c9 (Chr(10))\u3001\u307e\u305f\u306f\u30ad\u30e3\u30ea\u30c3\u30b8 \u30ea\u30bf\u30fc\u30f3\u3068\u30e9\u30a4\u30f3 \u30d5\u30a3\u30fc\u30c9\u306e\u7d44\u307f\u5408\u308f\u305b (Chr(13) &#038; Chr(10)) \u3092\u6539\u884c\u4f4d\u7f6e\u306b\u633f\u5165\u3057\u307e\u3059\u3002 <\/p>\n<p class=\"caution3\">\u5f15\u6570 Buttons \u3092\u7701\u7565\u3059\u308b\u3068\u3001\u65e2\u5b9a\u5024 vbOKOnly(0) \u306b\u306a\u308a\u3001\u300cOK\u300d\u30dc\u30bf\u30f3\u306e\u307f\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p class=\"caution3\">\u5f15\u6570 Title \u3092\u7701\u7565\u3059\u308b\u3068\u3001\u300cMicrosoft Excel\u300d\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p class=\"caution3\">\u5f15\u6570 Helpfile \u306b\u3001\u4f7f\u7528\u3059\u308b\u30d8\u30eb\u30d7\u30d5\u30a1\u30a4\u30eb\u306e\u540d\u524d\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067 [F1] \u30ad\u30fc\u3092\u62bc\u3057\u3066\u30d8\u30eb\u30d7\u3092\u53c2\u7167\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u306e\u3068\u304d \u5f15\u6570 Context \u3082\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<\/div>\n<br \/>\n<h2>\u30dc\u30bf\u30f3\u306e\u7a2e\u985e\u30fb\u500b\u6570\u30fb\u30b9\u30bf\u30a4\u30eb\u3092\u793a\u3059\u5b9a\u6570\u306e\u4e00\u89a7\uff08Bottons\uff09<\/h2>\n<div class=\"m30-l\">\n<h3>\u8868\u793a\u3059\u308b\u30dc\u30bf\u30f3<\/h3>\n<table>\n<tr>\n<td align=\"center\" width=\"220\"><strong>\u5b9a\u6570<\/strong><\/td>\n<td align=\"center\" width=\"70\"><strong>\u5024<\/strong><\/td>\n<td align=\"center\" width=\"300\"><strong>\u8868\u793a\u3059\u308b\u30dc\u30bf\u30f3<\/strong><\/td>\n<\/tr>\n<tr>\n<td>vbOKOnly \u3010\u898f\u5b9a\u5024\u3011<\/td>\n<td align=\"center\">0<\/td>\n<td> [OK] \u30dc\u30bf\u30f3\u306e\u307f<\/td>\n<\/tr>\n<tr>\n<td>vbOKCancel<\/td>\n<td align=\"center\">1<\/td>\n<td> [OK] \u30dc\u30bf\u30f3\u3068 [\u30ad\u30e3\u30f3\u30bb\u30eb] \u30dc\u30bf\u30f3<\/td>\n<\/tr>\n<tr>\n<td>vbAbortRetryIgnore<\/td>\n<td align=\"center\">2<\/td>\n<td> [\u4e2d\u6b62] [\u518d\u8a66\u884c] [\u7121\u8996] \u306e 3 \u3064\u306e\u30dc\u30bf\u30f3<\/td>\n<\/tr>\n<tr>\n<td>vbYesNoCancel<\/td>\n<td align=\"center\">3<\/td>\n<td> [\u306f\u3044] [\u3044\u3044\u3048] [\u30ad\u30e3\u30f3\u30bb\u30eb] \u306e 3 \u3064\u306e\u30dc\u30bf\u30f3<\/td>\n<\/tr>\n<tr>\n<td>vbYesNo<\/td>\n<td align=\"center\">4<\/td>\n<td> [\u306f\u3044] \u30dc\u30bf\u30f3\u3068 [\u3044\u3044\u3048] \u30dc\u30bf\u30f3<\/td>\n<\/tr>\n<tr>\n<td>vbRetryCancel<\/td>\n<td align=\"center\">5<\/td>\n<td> [\u518d\u8a66\u884c] \u30dc\u30bf\u30f3\u3068 [\u30ad\u30e3\u30f3\u30bb\u30eb] \u30dc\u30bf\u30f3<\/td>\n<\/tr>\n<\/table>\n<br \/>\n<h3>\u30a2\u30a4\u30b3\u30f3\u306e\u7a2e\u985e<\/h3>\n<table>\n<tr>\n<td align=\"center\" width=\"220\"><strong>\u5b9a\u6570<\/strong><\/td>\n<td align=\"center\" width=\"70\"><strong>\u5024<\/strong><\/td>\n<td align=\"center\" width=\"300\"><strong>\u8868\u793a\u3059\u308b\u30a2\u30a4\u30b3\u30f3<\/strong><\/td>\n<\/tr>\n<tr>\n<td>vbCritical<\/strong><\/td>\n<td align=\"center\">16<\/td>\n<td> \u8b66\u544a\u30e1\u30c3\u30bb\u30fc\u30b8 \u30a2\u30a4\u30b3\u30f3\u3092\u8868\u793a<\/strong><\/td>\n<\/tr>\n<tr>\n<td>vbQuestion<\/strong><\/td>\n<td align=\"center\">32<\/strong><\/td>\n<td> \u554f\u3044\u5408\u308f\u305b\u30e1\u30c3\u30bb\u30fc\u30b8 \u30a2\u30a4\u30b3\u30f3\u3092\u8868\u793a<\/strong><\/td>\n<\/tr>\n<tr>\n<td>vbExclamation<\/strong><\/td>\n<td align=\"center\">48<\/strong><\/td>\n<td> \u6ce8\u610f\u30e1\u30c3\u30bb\u30fc\u30b8 \u30a2\u30a4\u30b3\u30f3\u3092\u8868\u793a<\/strong><\/td>\n<\/tr>\n<tr>\n<td>vbInformation<\/strong><\/td>\n<td align=\"center\">64<\/strong><\/td>\n<td> \u60c5\u5831\u30e1\u30c3\u30bb\u30fc\u30b8 \u30a2\u30a4\u30b3\u30f3\u3092\u8868\u793a<\/strong><\/td>\n<\/tr>\n<\/table>\n<br \/>\n<h3>\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30dc\u30bf\u30f3<\/h3>\n<table>\n<tr>\n<td align=\"center\" width=\"220\"><strong>\u5b9a\u6570<\/strong><\/td>\n<td align=\"center\" width=\"70\"><strong>\u5024<\/strong><\/td>\n<td align=\"center\" width=\"300\"><strong>\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30dc\u30bf\u30f3<\/strong><\/td>\n<\/tr>\n<tr>\n<td>vbDefaultButton1 \u3010\u898f\u5b9a\u5024\u3011<\/td>\n<td align=\"center\">0<\/td>\n<td> \u7b2c 1 \u30dc\u30bf\u30f3<\/td>\n<\/tr>\n<tr>\n<td>vbDefaultButton2<\/td>\n<td align=\"center\">256<\/td>\n<td> \u7b2c 2 \u30dc\u30bf\u30f3<\/td>\n<\/tr>\n<tr>\n<td>vbDefaultButton3<\/td>\n<td align=\"center\">512<\/td>\n<td> \u7b2c 3 \u30dc\u30bf\u30f3<\/td>\n<\/tr>\n<tr>\n<td>vbDefaultButton4<\/td>\n<td align=\"center\">768<\/td>\n<td> \u7b2c 4 \u30dc\u30bf\u30f3<\/td>\n<\/tr>\n<\/table>\n<br \/>\n<h3>\u305d\u306e\u4ed6<\/h3>\n<table>\n<tr>\n<td align=\"center\" width=\"220\"><strong>\u5b9a\u6570<\/strong><\/td>\n<td align=\"center\" width=\"70\"><strong>\u5024<\/strong><\/td>\n<td align=\"center\" width=\"300\"><strong>\u5185\u5bb9<\/strong><\/td>\n<\/tr>\n<tr>\n<td>vbApplicationModal\u3010\u898f\u5b9a\u5024\u3011<\/td>\n<td align=\"center\">0<\/td>\n<td> \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30e2\u30fc\u30c0\u30eb\u306b\u8a2d\u5b9a<\/td>\n<\/tr>\n<tr>\n<td>vbSystemModal<\/td>\n<td align=\"center\">4096<\/td>\n<td> \u30b7\u30b9\u30c6\u30e0\u30e2\u30fc\u30c0\u30eb\u306b\u8a2d\u5b9a<\/td>\n<\/tr>\n<tr>\n<td>vbMsgBoxHelpButton<\/td>\n<td align=\"center\">16384<\/td>\n<td> \u30d8\u30eb\u30d7 \u30dc\u30bf\u30f3\u3092\u8868\u793a<\/td>\n<\/tr>\n<tr>\n<td>VbMsgBoxSetForeground<\/td>\n<td align=\"center\">65536<\/td>\n<td> \u6700\u524d\u9762\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u3068\u3057\u3066\u8868\u793a<\/td>\n<\/tr>\n<tr>\n<td>vbMsgBoxRight<\/td>\n<td align=\"center\">524288<\/td>\n<td> \u30c6\u30ad\u30b9\u30c8\u3092\u53f3\u5bc4\u305b\u3067\u8868\u793a<\/td>\n<\/tr>\n<tr>\n<td>vbMsgBoxRtlReading<\/td>\n<td align=\"center\">1048576<\/td>\n<td> \u30c6\u30ad\u30b9\u30c8\u3092\u3001\u53f3\u304b\u3089\u5de6\u306e\u65b9\u5411\u3067\u8868\u793a<\/td>\n<\/tr>\n<\/table>\n<br \/><\/div>\n<br \/><br \/>\n<h2>MsgBox\u95a2\u6570\u306e\u623b\u308a\u5024\uff08result\uff09<\/h2>\n<div class=\"m30-l\">\n<table>\n<tr>\n<td align=\"center\" width=\"220\"><strong>\u5b9a\u6570<\/strong><\/td>\n<td align=\"center\" width=\"70\"><strong>\u5024<\/strong><\/td>\n<td align=\"center\" width=\"300\"><strong>\u5185\u5bb9<\/strong><\/td>\n<\/tr>\n<tr>\n<td>vbOK<\/td>\n<td align=\"center\">1<\/td>\n<td> [OK] <\/td>\n<\/tr>\n<tr>\n<td>vbCancel<\/td>\n<td align=\"center\">2<\/td>\n<td> [\u30ad\u30e3\u30f3\u30bb\u30eb] <\/td>\n<\/tr>\n<tr>\n<td>vbAbort<\/td>\n<td align=\"center\">3<\/td>\n<td> [\u4e2d\u6b62] <\/td>\n<\/tr>\n<tr>\n<td>vbRetry<\/td>\n<td align=\"center\">4<\/td>\n<td> [\u518d\u8a66\u884c] <\/td>\n<\/tr>\n<tr>\n<td>vbIgnore<\/td>\n<td align=\"center\">5<\/td>\n<td> [\u7121\u8996] <\/td>\n<\/tr>\n<tr>\n<td>vbYes<\/td>\n<td align=\"center\">6<\/td>\n<td> [\u306f\u3044] <\/td>\n<\/tr>\n<tr>\n<td>vbNo<\/td>\n<td align=\"center\">7<\/td>\n<td> [\u3044\u3044\u3048] <\/td>\n<\/tr>\n<\/table>\n<br \/><\/div>\n<br \/><br \/>\n<h2>MsgBox\u95a2\u6570\u306e\u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3>VBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"MsgBox\u95a2\u6570\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub sample_msgbox()\r\n\r\n    \r\n    Dim Result, Prompt, Buttons, Title\r\n    \r\n    Prompt = \"\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u306e\u4f7f\u7528\u4f8b\u3067\u3059\u3002\" & Chr(13) & \"\u7d9a\u884c\u3057\u307e\u3059\u304b\uff1f\"\r\n    Buttons = vbYesNoCancel + vbInformation + vbDefaultButton2\r\n    Title = \"\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u4f7f\u7528\u4f8b\"\r\n    \r\n    Result = MsgBox(Prompt, Buttons, Title)\r\n\r\n    If Result = vbYes Then\r\n        MsgBox \"YES\"\r\n    ElseIf Result = vbNo Then\r\n        MsgBox \"NO\"\r\n    Else\r\n        MsgBox \"CANCEL\"\r\n    End If\r\n\r\n\r\nEnd Sub\r\n\r\n\u3000\r\n<\/pre>\n<h3>MsgBox\u95a2\u6570\u306e\u30de\u30af\u30ed\u5b9f\u884c\u4f8b<\/h3>\n<p><a href=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/02\/msgbox01.jpg?ssl=1\" rel=\"lightbox[776]\"><img loading=\"lazy\" src=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/02\/msgbox01.jpg?resize=349%2C196&#038;ssl=1\" alt=\"\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u4f7f\u7528\u4f8b\" width=\"349\" height=\"196\" class=\"alignnone size-full wp-image-851\" data-recalc-dims=\"1\" \/><\/a>\n<\/div>\n<br \/>\n","protected":false},"excerpt":{"rendered":"<p>MsgBox\u95a2\u6570 \u3010\u66f8\u5f0f\u3011 result = MsgBox ( Prompt [ &#8230; <\/p>\n","protected":false},"author":1,"featured_media":851,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[37],"tags":[44,38,43],"jetpack_featured_media_url":"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2015\/02\/msgbox01.jpg?fit=349%2C196&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-cw","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/776"}],"collection":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/comments?post=776"}],"version-history":[{"count":78,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/776\/revisions"}],"predecessor-version":[{"id":911,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/776\/revisions\/911"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/851"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=776"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}