{"id":366,"date":"2023-10-31T18:23:37","date_gmt":"2023-10-31T18:23:37","guid":{"rendered":"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/"},"modified":"2023-12-10T11:48:56","modified_gmt":"2023-12-10T11:48:56","slug":"vba%e6%b6%88%e6%81%af%e6%a1%86","status":"publish","type":"page","link":"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/","title":{"rendered":"\u5982\u4f55\u5728excel\u4e2d\u521b\u5efa\u6d88\u606f\u6846\u51fd\u6570\uff1f"},"content":{"rendered":"<div class=\"excel-\" id=\"excel-2214831919\"><script type=\"text\/javascript\">\r\n\tatOptions = {\r\n\t\t'key' : 'c1158f160081d6540a8409e6925dab94',\r\n\t\t'format' : 'iframe',\r\n\t\t'height' : 250,\r\n\t\t'width' : 300,\r\n\t\t'params' : {}\r\n\t};\r\n<\/script>\r\n<script type=\"text\/javascript\" src=\"\/\/www.highperformanceformat.com\/c1158f160081d6540a8409e6925dab94\/invoke.js\"><\/script><\/div> <p>\u6211\u5b66\u5230\u7684\u5173\u4e8e VBA \u7684\u7b2c\u4e00\u4ef6\u4e8b\u662f\u5982\u4f55\u4f7f\u7528\u6d88\u606f\u6846\uff08\u201cmsgbox \u51fd\u6570\u201d\uff09\u3002\u5b83\u5c31\u50cf Excel \u7a97\u53e3\u4e0a\u7684\u4e00\u4e2a\u7b80\u5355\u7684\u5f39\u51fa\u6846\uff0c\u7528\u4e8e\u663e\u793a\u7279\u5b9a\u6d88\u606f\u3002\u5982\u679c\u60a8\u8003\u8651\u4e00\u4e0b\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4e24\u79cd\u65b9\u5f0f\u4f7f\u7528\u5b83\u3002<\/p><ul><li><strong>\u5411\u7528\u6237\u4f20\u9012\u6d88\u606f\u3002<\/strong><\/li><li><strong>\u4ece\u7528\u6237\u90a3\u91cc\u83b7\u53d6\u7b80\u5355\u7684\u54cd\u5e94\u3002<\/strong><\/li><\/ul><p>\u5927\u591a\u6570 VBA \u7a0b\u5e8f\u5458\u5728\u4ed6\u4eec\u7684\u5b8f\u4ee3\u7801\u4e2d\u4f7f\u7528\u5b83\u6765\u4f7f\u5b83\u4eec\u66f4\u5177\u4ea4\u4e92\u6027\uff0c\u5982\u679c\u60a8\u4e0d\u77e5\u9053\u5b83\uff0c\u6211\u6562\u6253\u8d4c\u8bfb\u5b8c\u672c\u6587\u540e\u60a8\u4f1a\u7231\u4e0a\u5b83\u3002<\/p><p><strong><span style=\"background-color: #ffff00;\">\u4e13\u5bb6\u63d0\u793a\uff1a<\/span><\/strong>\u5982\u679c\u60a8\u662f VBA \u521d\u5b66\u8005\uff0c\u90a3\u4e48\u4e86\u89e3\u6709\u5173 VBA \u6d88\u606f\u6846\u7684\u66f4\u591a\u4fe1\u606f\u53ef\u80fd\u662f\u4e2a\u597d\u4e3b\u610f\u3002<\/p><p>\u56e0\u6b64\uff0c\u4eca\u5929\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u60f3\u4e0e\u60a8\u5206\u4eab\u6709\u5173\u5728 Excel \u4e2d\u4f7f\u7528\u6d88\u606f\u6846\u7684\u6240\u6709\u8be6\u7ec6\u4fe1\u606f\u4ee5\u53ca\u4e00\u4e9b\u5b9e\u9645\u793a\u4f8b\u3002<\/p><p> \u2026\u8ba9\u6211\u4eec\u5f00\u59cb\u5427\u3002<\/p><h2>\u53e5\u6cd5<\/h2><p>=MSGBOX\uff08\u63d0\u793a\uff0c[\u6309\u94ae]\uff0c[\u6807\u9898]\uff0c[\u5e2e\u52a9\u6587\u4ef6\uff0c\u4e0a\u4e0b\u6587]\uff09 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/syntaxe-fonction-vba-msgbox.png\" sizes=\"auto, \" srcset=\"\" alt=\"msgbox vba\u51fd\u6570\u8bed\u6cd5\" width=\"317\" height=\"250\" data-attachment-id=\"14803\"><\/p><ul><li>\u63d0\u793a \u7528\u4e8e\u663e\u793a\u4e3a\u6d88\u606f\u7684\u5b57\u7b26\u4e32\u8868\u8fbe\u5f0f\u3002\u6700\u5927\u5b57\u7b26\u957f\u5ea6\u4e3a 1024\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u5b57\u7b26\u5bbd\u5ea6\u3002<\/li><li> [buttons] \u60a8\u53ef\u4ee5\u4f7f\u7528\u6b64\u53c2\u6570\u6765\u6307\u5b9a\u6309\u94ae\u3001\u56fe\u6807\u6837\u5f0f\u3001\u6309\u94ae\u6807\u8bc6\u548c\u6d88\u606f\u6846\u6a21\u5f0f\u3002<\/li><li> [title] \u60a8\u53ef\u4ee5\u4f7f\u7528\u6b64\u53c2\u6570\u6307\u5b9a\u6d88\u606f\u6846\u7684\u6807\u9898\u6587\u672c\u3002<\/li><li> [helpfile] \u6b64\u53c2\u6570\u5c06\u5e2e\u52a9\u60a8\u4e3a\u7528\u6237\u6307\u5b9a\u5e2e\u52a9\u6587\u4ef6\u3002\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5e2e\u52a9\u6309\u94ae\u8bbf\u95ee\u6b64\u5e2e\u52a9\u6587\u4ef6\u3002\u5982\u679c\u6307\u5b9a\u5e2e\u52a9\u6587\u4ef6\uff0c\u5219\u5fc5\u987b\u6307\u5b9a\u4e0a\u4e0b\u6587\u7f16\u53f7\u3002<\/li><li> [\u4e0a\u4e0b\u6587] \u7528\u4e8e\u4ece\u5e2e\u52a9\u83dc\u5355\u5206\u914d\u5e2e\u52a9\u4e3b\u9898\u7684\u6570\u5b57\u8868\u8fbe\u5f0f\u3002<\/li><\/ul><p><strong>\u6ce8\u610f\uff1a<\/strong>\u5728\u4e0a\u9762\u7684\u5217\u8868\u4e2d\uff0c\u65b9\u62ec\u53f7\u4e2d\u7684\u53c2\u6570\u662f\u53ef\u9009\u7684\uff0c\u60a8\u53ef\u4ee5\u8df3\u8fc7\u6765\u6307\u5b9a\u5b83\u4eec\u3002<\/p><h2>\u5982\u4f55\u81ea\u5b9a\u4e49\u6d88\u606f\u6846\u5e76\u4f7f\u7528\u4e0d\u540c\u7684\u6309\u94ae<\/h2><p>\u60a8\u53ef\u4ee5\u4f7f\u7528\u6240\u6709\u53ef\u7528\u9009\u9879\u8f7b\u677e\u81ea\u5b9a\u4e49 VBA \u6d88\u606f\u6846\u3002\u8ba9\u6211\u4eec\u770b\u4e00\u4e0b\u8fd9\u4e9b\u9009\u9879\u3002 <\/p><h3 style=\"font-size: 22px; margin-bottom: 20px !important; margin-top: 0px !important;\" data-fontsize=\"18\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-lineheight=\"27\"> #1.\u4ec5vbOK<\/h3><p>\u8fd9\u4e3a\u60a8\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u201c\u786e\u5b9a\u201d\u6309\u94ae\u3002\u7528\u6237\u9605\u8bfb\u6d88\u606f\u540e\u53ef\u4ee5\u5355\u51fb\u5b83\u6765\u5173\u95ed\u5b83\u3002\u5355\u51fb\u201c\u786e\u5b9a\u201d\u6309\u94ae\u540e\uff0c\u60a8\u8fd8\u53ef\u4ee5\u53e6\u5916\u4f7f\u7528\u5b8f\u6765\u8fd0\u884c\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/vba-msgbox-avec-vbokonly.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"142\" height=\"143\" data-attachment-id=\"14806\"><\/p><p>\u5728 OKOnly() \u4e0b<\/p><p>MsgBox \u63d0\u793a := \u201c\u8fd9\u662f\u4e00\u4e2a MsgBox\u201d, _<\/p><p>\u6309\u94ae\uff1a=vbOKOnly\uff0c_<\/p><p>\u6807\u9898\uff1a=\u201c\u90ae\u7bb1\u201d<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h3 style=\"font-size: 22px; margin-bottom: 20px !important; margin-top: 0px !important;\" data-fontsize=\"18\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-lineheight=\"27\"> #2. vb\u786e\u5b9a\u53d6\u6d88<\/h3><p>\u8be5\u5e38\u91cf\u4e3a\u60a8\u63d0\u4f9b\u4e86\u201c\u786e\u5b9a\u201d\u548c\u201c\u53d6\u6d88\u201d\u6309\u94ae\u3002\u7528\u6237\u73b0\u5728\u6709\u4e24\u4e2a\u9009\u62e9\uff1a\u6309\u201c\u786e\u5b9a\u201d\u7ee7\u7eed\u6216\u53d6\u6d88\u9000\u51fa\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/vba-msgbox-avec-vbokcancel.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"237\" height=\"143\" data-attachment-id=\"14808\"><\/p><p>\u5728 OKCancel() \u4e0b<\/p><p>MsgBox\u63d0\u793a\uff1a= \u00bb\u4f60\u8fd8\u597d\u5417\uff1f \u00bb, _<\/p><p>\u6309\u94ae\uff1a=vbOKCancel\uff0c_<\/p><p>\u6807\u9898\uff1a=\u201c\u90ae\u7bb1\u201d<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h3 style=\"margin-bottom: 15px !important; margin-top: 0px !important; font-size: 22px;\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-fontsize=\"18\" data-lineheight=\"27\"> \uff033\u3002 vbAbort\u91cd\u8bd5\u5ffd\u7565<\/h3><p>\u8fd9\u5141\u8bb8\u60a8\u663e\u793a\u201c\u5173\u4e8e\u201d\u3001\u201c\u91cd\u8bd5\u201d\u548c\u201c\u8df3\u8fc7\u201d\u4e09\u4e2a\u6309\u94ae\u3002\u7528\u6237\u53ef\u4ee5\u4e2d\u6b62\u64cd\u4f5c\u3001\u91cd\u8bd5\u6216\u5ffd\u7565\u5b83\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/vba-msgbox-avec-vbabortretryignore.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"335\" height=\"143\" data-attachment-id=\"14810\"><\/p><p>\u5728 OKCancel() \u4e0b<\/p><p>MsgBox\u63d0\u793a\uff1a= \u00bb\u4f60\u8fd8\u597d\u5417\uff1f \u00bb, _<\/p><p>\u6309\u94ae\uff1a=vbOKCancel\uff0c_<\/p><p>\u6807\u9898\uff1a=\u201c\u90ae\u7bb1\u201d<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h3 style=\"font-size: 22px; margin-bottom: 20px !important; margin-top: 0px !important;\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-fontsize=\"18\" data-lineheight=\"27\"> \uff034\u3002 vb\u662f\u5426\u53d6\u6d88<\/h3><p>\u8be5\u5e38\u91cf\u663e\u793a\u4e09\u4e2a\u6309\u94ae\uff0c\u5206\u522b\u662f\u201c\u662f\u201d\u3001\u201c\u5426\u201d\u548c\u201c\u53d6\u6d88\u201d\u3002\u7528\u6237\u53ef\u4ee5\u9009\u62e9\u201c\u662f\u201d\u63a5\u53d7\u5e76\u7ee7\u7eed\uff0c\u201c\u5426\u201d\u62d2\u7edd\u6216\u53d6\u6d88\u5173\u95ed\u6d88\u606f\u6846\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/vba-msgbox-avec-vbyesnocancel.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"335\" height=\"143\" data-attachment-id=\"14812\"><\/p><p>\u5728 YesNoCancel() \u4e0b<\/p><p>MsgBox Prompt := &#8220;\u73b0\u5728\u4f60\u6709\u4e09\u4e2a\u6309\u94ae&#8221;, _<\/p><p>\u6309\u94ae:=vbYesNoCancel, _<\/p><p>\u6807\u9898\uff1a=\u201c\u90ae\u7bb1\u201d<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h3 style=\"font-size: 22px; margin-bottom: 15px !important;\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-fontsize=\"18\" data-lineheight=\"27\"> \uff035\u3002 vb\u662f\u5426<\/h3><p>\u8be5\u5e38\u91cf\u663e\u793a\u201c\u662f\u201d\u548c\u201c\u5426\u201d\u4e24\u4e2a\u6309\u94ae\u3002\u7528\u6237\u53ef\u4ee5\u5355\u51fb\u201c\u662f\u201d\u63a5\u53d7\u5e76\u7ee7\u7eed\uff0c\u6216\u8005\u5355\u51fb\u201c\u5426\u201d\u62d2\u7edd\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/vba-msgbox-avec-vbyesno.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"237\" height=\"143\" data-attachment-id=\"14816\"><\/p><p>\u5728 YesNo() \u4e0b<\/p><p>MsgBox Prompt := &#8220;\u73b0\u5728\u4f60\u6709\u4e24\u4e2a\u6309\u94ae&#8221;, _<\/p><p>\u6309\u94ae\uff1a=vbYesNo, _<\/p><p>\u6807\u9898\uff1a=\u201c\u90ae\u7bb1\u201d<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h3 style=\"margin-bottom: 15px !important; font-size: 22px;\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-fontsize=\"18\" data-lineheight=\"27\"> \uff036\u3002 vb\u91cd\u8bd5\u53d6\u6d88<\/h3><p>\u73b0\u5728\u5b83\u663e\u793a\u4e24\u4e2a\u6309\u94ae\uff0c\u91cd\u8bd5\u548c\u53d6\u6d88\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u8981\u6c42\u7528\u6237\u91cd\u8bd5\u64cd\u4f5c\u6216\u53d6\u6d88\u64cd\u4f5c\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/vba-msgbox-avec-vbretrycancel.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"237\" height=\"143\" data-attachment-id=\"14819\"><\/p><p> Sub RetryCancel()MsgBox Prompt:=\u201d\u8bf7\u91cd\u8bd5\u201d, _Buttons:=vbRetryCancel, _Title:=\u201dMsgBox\u201dEnd Sub <\/p><h3 style=\"font-size: 22px; margin-bottom: 15px !important;\" data-fontsize=\"18\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-lineheight=\"27\"> #7. vb\u8bc4\u8bba<\/h3><p>\u8be5\u5e38\u91cf\u5728\u6d88\u606f\u6846\u4e2d\u663e\u793a\u4e00\u4e2a\u56fe\u6807\uff0c\u8868\u660e\u8be5\u6d88\u606f\u5f88\u91cd\u8981\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/vba-msgbox-avec-vbcritical.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"175\" height=\"160\" data-attachment-id=\"14822\"><\/p><p>\u4e9a\u4e34\u754c()<\/p><p> MsgBox \u63d0\u793a := \u201c\u8fd9\u5f88\u5173\u952e\u201d, _<\/p><p>\u6309\u94ae\uff1a=vbCritical\uff0c_<\/p><p>\u6807\u9898\uff1a=\u201c\u90ae\u7bb1\u201d<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h3 style=\"margin-bottom: 15px !important; font-size: 22px;\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-fontsize=\"18\" data-lineheight=\"27\"> \uff038\u3002 vb\u95ee\u9898<\/h3><p>\u5f53\u5411\u7528\u6237\u8be2\u95ee\u95ee\u9898\u65f6\u53ef\u4ee5\u4f7f\u7528\u8be5\u5e38\u91cf\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/vba-msgbox-avec-vbquestion.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"195\" height=\"160\" data-attachment-id=\"14825\"><\/p><p>\u5b50\u95ee\u9898()<\/p><p> MsgBox \u63d0\u793a := \u00bb\u73b0\u5728\u8be5\u600e\u4e48\u529e\uff1f \u00bb, _<\/p><p>\u6309\u94ae\uff1a=vbQuestion\uff0c_<\/p><p>\u6807\u9898\uff1a=\u201c\u90ae\u7bb1\u201d<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h3 style=\"margin-bottom: 15px !important; margin-top: 0px !important; font-size: 22px;\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-fontsize=\"18\" data-lineheight=\"27\"> \uff039\u3002 vb\u611f\u53f9\u53f7<\/h3><p>\u8be5\u5e38\u91cf\u5c06\u663e\u793a\u5e26\u6709\u6d88\u606f\u7684\u611f\u53f9\u53f7\u56fe\u6807\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/vba-msgbox-avec-vbexclamation.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"195\" height=\"160\" data-attachment-id=\"14828\"><\/p><p>\u611f\u53f9\u53f7\u4e0b()<\/p><p> MsgBox \u63d0\u793a := \u00bb\u73b0\u5728\u8be5\u600e\u4e48\u529e\uff1f \u00bb, _<\/p><p>\u6309\u94ae\uff1a=vb\u611f\u53f9\u53f7\uff0c_<\/p><p>\u6807\u9898\uff1a=\u201c\u90ae\u7bb1\u201d<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h3 style=\"margin-bottom: 15px !important; margin-top: 0px !important; font-size: 22px;\" data-fontsize=\"18\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-lineheight=\"27\"> \uff03\u5341\u3002 vb\u4fe1\u606f<\/h3><p>\u5b83\u5c06\u663e\u793a\u4e00\u4e2a\u56fe\u6807\uff0c\u8868\u660e\u8be5\u6d88\u606f\u662f\u4fe1\u606f\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/vba-msgbox-avec-vbinformation.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"195\" height=\"160\" data-attachment-id=\"14829\"><\/p><p> Sub Information()MsgBox Prompt:=\u201d\u73b0\u5728\u505a\u4ec0\u4e48\uff1f\u201d, _Buttons:=vbInformation, _Title:=\u201dMsgBox\u201dEnd Sub <\/p><h3 style=\"margin-bottom: 15px !important; font-size: 22px;\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-fontsize=\"18\" data-lineheight=\"27\"> \uff0311\u3002 vb\u9ed8\u8ba4\u6309\u94ae1<\/h3><p>\u4f7f\u7528\u6b64\u5e38\u91cf\u5c06\u6d88\u606f\u6846\u4e2d\u7684\u7b2c\u4e00\u4e2a\u6309\u94ae\u6307\u5b9a\u4e3a\u9ed8\u8ba4\u6309\u94ae\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/vba-msgbox-avec-vbdefaultbutton1.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"431\" height=\"143\" data-attachment-id=\"14833\"><\/p><p> Sub DefaultButton1()MsgBox Prompt:=\u201dButton1 \u7a81\u51fa\u663e\u793a\uff1f\u201d, _Buttons:=vbYesNoCancel + vbMsgBoxHelpButton + vbDefaultButton1, _Title:=\u201dMsgBox\u201dEnd Sub <\/p><h3 style=\"margin-bottom: 15px !important; font-size: 22px;\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-fontsize=\"18\" data-lineheight=\"27\"> \uff0312\u3002 vb\u9ed8\u8ba4\u6309\u94ae2<\/h3><p>\u4f7f\u7528\u6b64\u5e38\u91cf\u5c06\u6d88\u606f\u6846\u4e2d\u7684\u7b2c\u4e8c\u4e2a\u6309\u94ae\u6307\u5b9a\u4e3a\u9ed8\u8ba4\u6309\u94ae\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/msgbox-vba-avec-vbdefaultbutton2.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"431\" height=\"143\" data-attachment-id=\"14834\"><\/p><p> Sub DefaultButton2()MsgBox Prompt:=\u201dButton2 \u7a81\u51fa\u663e\u793a\uff1f\u201d, _Buttons:=vbYesNoCancel + vbMsgBoxHelpButton + vbDefaultButton2, _Title:=\u201dMsgBox\u201dEnd Sub <\/p><h3 style=\"margin-bottom: 15px !important; font-size: 22px;\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-fontsize=\"18\" data-lineheight=\"27\"> \uff0313\u3002 vb\u9ed8\u8ba4\u6309\u94ae3<\/h3><p>\u4f7f\u7528\u6b64\u5e38\u91cf\u5c06\u6d88\u606f\u6846\u4e2d\u7684\u7b2c\u4e09\u4e2a\u6309\u94ae\u6307\u5b9a\u4e3a\u9ed8\u8ba4\u6309\u94ae\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/msgbox-vba-avec-vbdefaultbutton3.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"431\" height=\"143\" data-attachment-id=\"14835\"><\/p><p> Sub DefaultButton3()MsgBox Prompt:=\u201dButton3 \u7a81\u51fa\u663e\u793a\uff1f\u201d, _Buttons:=vbYesNoCancel + vbMsgBoxHelpButton + vbDefaultButton3, _Title:=\u201dMsgBox\u201dEnd Sub <\/p><h3 style=\"margin-bottom: 15px !important; font-size: 22px;\" data-fontsize=\"18\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-lineheight=\"27\"> \uff0314\u3002 vb\u9ed8\u8ba4\u6309\u94ae4<\/h3><p>\u4f7f\u7528\u6b64\u5e38\u91cf\u5c06\u6d88\u606f\u6846\u4e2d\u7684\u7b2c\u56db\u4e2a\u6309\u94ae\u6307\u5b9a\u4e3a\u9ed8\u8ba4\u6309\u94ae\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/vba-msgbox-avec-vbdefaultbutton4.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"431\" height=\"143\" data-attachment-id=\"14836\"><\/p><p> Sub DefaultButton4()MsgBox Prompt:=\u201dButton4 \u7a81\u51fa\u663e\u793a\uff1f\u201d, _Buttons:=vbYesNoCancel + vbMsgBoxHelpButton + vbDefaultButton4, _Title:=\u201dMsgBox\u201dEnd Sub <\/p><h3 style=\"font-size: 22px; margin-bottom: 15px !important; margin-top: 0px !important;\" data-fontsize=\"18\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-lineheight=\"27\"> \uff0315\u3002 vb\u5e94\u7528\u7a0b\u5e8f\u6a21\u5f0f<\/h3><p>\u8be5\u5e38\u91cf\u5c06\u6682\u505c\u5e94\u7528\u7a0b\u5e8f\uff08Excel\uff09\uff0c\u7528\u6237\u5fc5\u987b\u56de\u590dmsgbox\u624d\u80fd\u4f7f\u7528\u5e94\u7528\u7a0b\u5e8f\u3002<\/p><p>\u5728 OKOnly() \u4e0b<\/p><p>MsgBox \u63d0\u793a := \u201c\u8fd9\u662f\u4e00\u4e2a MsgBox\u201d, _<\/p><p>\u6309\u94ae\uff1a=vbOKOnly\uff0c_<\/p><p>\u6807\u9898\uff1a=\u201c\u90ae\u7bb1\u201d\uff0c_<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h3 style=\"font-size: 22px; margin-bottom: 15px !important; margin-top: 0px !important;\" data-fontsize=\"18\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-lineheight=\"27\"> \uff0316\u3002 vb\u7cfb\u7edf\u6a21\u6001<\/h3><p>\u8be5\u5e38\u91cf\u5c06\u6682\u505c\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u6240\u6709\u5e94\u7528\u7a0b\u5e8f\uff0c\u7528\u6237\u5fc5\u987b\u9996\u5148\u54cd\u5e94\u6d88\u606f\u6846\u3002<\/p><p> Sub ApplicationModal()MsgBox Prompt := \u00bb\u8fd9\u662f\u5e94\u7528\u7a0b\u5e8f\u6a21\u5f0f\u00bb, _Buttons :=vbOK + vbApplicationModal, _Title := \u00bbMsgBox \u00bbEnd Sub <\/p><h3 style=\"font-size: 22px; margin-bottom: 15px !important; margin-top: 0px !important;\" data-fontsize=\"18\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-lineheight=\"27\"> \uff0317\u3002 vbMsgBox\u5e2e\u52a9\u6309\u94ae<\/h3><p>\u4f7f\u7528\u6b64\u5e38\u91cf\u5411\u60a8\u7684\u90ae\u7bb1\u6dfb\u52a0\u5e2e\u52a9\u6309\u94ae\u3002\u60a8\u53ef\u4ee5\u6dfb\u52a0\u5e2e\u52a9\u6587\u4ef6\u548c\u4e0a\u4e0b\u6587\u7f16\u53f7\u4ee5\u4f7f\u7528\u5e2e\u52a9\u6309\u94ae\u3002<\/p><p> Sub HelpButton()MsgBox Prompt:=\u201d\u4f7f\u7528\u5e2e\u52a9\u6309\u94ae\u201d, _Buttons:=vbOK + vbMsgBoxHelpButton, _Title:=\u201dMsgBox\u201d, _HelpFile:=\u201dC:UsersPuneet GogiaDesktopsamplehelp.chm\u201d, _Context:=101End Sub<\/p><p>\u4e00\u65e6\u7528\u6237\u5355\u51fb\u5e2e\u52a9\u6309\u94ae\uff0c\u5c31\u4f1a\u51fa\u73b0\u5e2e\u52a9\u83dc\u5355\u3002 <\/p><h3 style=\"font-size: 22px; margin-bottom: 15px !important; margin-top: 0px !important;\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-fontsize=\"18\" data-lineheight=\"27\"> \uff0318\u3002 vbMsgBoxSetForeground<\/h3><p>\u8be5\u5e38\u91cf\u5c06\u5e2e\u52a9\u60a8\u4f7f\u6d88\u606f\u6846\u7a97\u53e3\u6210\u4e3a\u524d\u53f0\u7a97\u53e3\u3002<\/p><p> Sub SetForeground()MsgBox Prompt:=\u201d\u6b64 MsgBox \u5728\u524d\u53f0\u201d, _Buttons:=vbOK + vbMsgBoxSetForeground, _Title:=\u201dMsgBox\u201dEnd Sub <\/p><h3 style=\"font-size: 22px; margin-bottom: 15px !important; margin-top: 0px !important;\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-fontsize=\"18\" data-lineheight=\"27\"> \uff0319\u3002 vbMsgBoxRight<\/h3><p>\u6587\u672c\u5c06\u4f7f\u7528\u6b64\u5e38\u91cf\u53f3\u5bf9\u9f50\u3002<\/p><p>\u5728 MsgBoxRight() \u4e0b<\/p><p>MsgBox Prompt := \u201c\u6587\u5b57\u5728\u53f3\u8fb9\u201d, _<\/p><p>\u6309\u94ae\uff1a=vbOK + vbMsgBoxRight, _<\/p><p>\u6807\u9898\uff1a=\u201c\u90ae\u7bb1\u201d<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h3 style=\"font-size: 22px; margin-bottom: 15px !important; margin-top: 0px !important;\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-fontsize=\"18\" data-lineheight=\"27\"> \uff0320\u3002 vbMsgBoxRtl\u8bfb\u53d6<\/h3><p>\u4f7f\u7528\u6b64\u5e38\u91cf\uff0c\u6d88\u606f\u6846\u5c06\u5411\u53f3\u7ffb\u8f6c\u3002\u8be5\u5e38\u6570\u4e3b\u8981\u662f\u4e3a\u5e0c\u4f2f\u6765\u8bed\u548c\u963f\u62c9\u4f2f\u8bed\u7cfb\u7edf\u8bbe\u8ba1\u7684\u3002<\/p><p>\u5728 MsgBoxRtlRead() \u4e0b<\/p><p>MsgBox Prompt := \u201c\u6b64\u6846\u5df2\u7ffb\u8f6c\u201d, _<\/p><p>\u6309\u94ae:=vbOK + vbMsgBoxRtlRead, _<\/p><p>\u6807\u9898\uff1a=\u201c\u90ae\u7bb1\u201d<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h2 id=\"tab-con-8\" style=\"margin-bottom: 20px !important;\" data-fontsize=\"28\" data-lineheight=\"42\">\u8fd4\u56de\u503c<\/h2><p>\u6bcf\u6b21\u7528\u6237\u901a\u8fc7\u5355\u51fb\u5176\u4e2d\u4e00\u4e2a\u6309\u94ae\u6765\u54cd\u5e94\u6d88\u606f\u6846\u65f6\uff0c\u90fd\u4f1a\u751f\u6210\u4e00\u4e2a\u6570\u5b57\u3002\u8fd9\u5c06\u5e2e\u52a9\u60a8\u8bc6\u522b\u7528\u6237\u5355\u51fb\u4e86\u54ea\u4e2a\u6309\u94ae\u3002 <\/p><table class=\"mtr-table mtr-thead-th\" style=\"margin-top: 0px !important; margin-bottom: 20px !important;\" data-rows=\"8\" data-cols=\"3\" data-tve-custom-colour=\"16460717\"><thead><tr><th class=\"mtr-th-tag\" data-tve-custom-colour=\"55690541\" data-mtr-content=\"Constant\"><div class=\"mtr-cell-content\">\u6301\u7eed\u7684<\/div><\/th><th class=\"mtr-th-tag\" data-tve-custom-colour=\"29870761\" data-mtr-content=\"Value\"><div class=\"mtr-cell-content\">\u4ef7\u503c<\/div><\/th><th class=\"mtr-th-tag\" data-tve-custom-colour=\"55301951\" data-mtr-content=\"Description\"><div class=\"mtr-cell-content\">\u63cf\u8ff0<\/div><\/th><\/tr><\/thead><tbody><tr><td class=\"mtr-td-tag\" data-tve-custom-colour=\"41996507\" data-mtr-content=\"Constant\"><div class=\"mtr-cell-content\">\u597d<\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"28891566\" data-mtr-content=\"Value\"><div class=\"mtr-cell-content\"> 1 <\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"50801664\" data-mtr-content=\"Description\"><div class=\"mtr-cell-content\">\u597d\u7684<\/div><\/td><\/tr><tr><td class=\"mtr-td-tag\" data-tve-custom-colour=\"98145453\" data-mtr-content=\"Constant\"><div class=\"mtr-cell-content\">\u53d6\u6d88<\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"35044744\" data-mtr-content=\"Value\"><div class=\"mtr-cell-content\"> 2 <\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"33697450\" data-mtr-content=\"Description\"><div class=\"mtr-cell-content\">\u53d6\u6d88<\/div><\/td><\/tr><tr><td class=\"mtr-td-tag\" data-tve-custom-colour=\"29220062\" data-mtr-content=\"Constant\"><div class=\"mtr-cell-content\"> vb\u4e2d\u6b62<\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"44631822\" data-mtr-content=\"Value\"><div class=\"mtr-cell-content\"> 3 <\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"87798468\" data-mtr-content=\"Description\"><div class=\"mtr-cell-content\">\u6d41\u4ea7<\/div><\/td><\/tr><tr><td class=\"mtr-td-tag\" data-tve-custom-colour=\"67330579\" data-mtr-content=\"Constant\"><div class=\"mtr-cell-content\"> vb\u518d\u8bd5\u4e00\u6b21<\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"714382\" data-mtr-content=\"Value\"><div class=\"mtr-cell-content\"> 4 <\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"97829037\" data-mtr-content=\"Description\"><div class=\"mtr-cell-content\">\u91cd\u65b0\u5f00\u59cb<\/div><\/td><\/tr><tr><td class=\"mtr-td-tag\" data-tve-custom-colour=\"24936662\" data-mtr-content=\"Constant\"><div class=\"mtr-cell-content\">\u8df3\u8fc7<\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"51432601\" data-mtr-content=\"Value\"><div class=\"mtr-cell-content\"> 5 <\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"26493383\" data-mtr-content=\"Description\"><div class=\"mtr-cell-content\">\u5ffd\u7565<\/div><\/td><\/tr><tr><td class=\"mtr-td-tag\" data-tve-custom-colour=\"52901802\" data-mtr-content=\"Constant\"><div class=\"mtr-cell-content\"> vb\u662f\u7684<\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"48521301\" data-mtr-content=\"Value\"><div class=\"mtr-cell-content\"> 6 <\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"67193381\" data-mtr-content=\"Description\"><div class=\"mtr-cell-content\">\u662f\u7684<\/div><\/td><\/tr><tr><td class=\"mtr-td-tag\" data-tve-custom-colour=\"24036290\" data-mtr-content=\"Constant\"><div class=\"mtr-cell-content\"> vb\u53f7<\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"22797535\" data-mtr-content=\"Value\"><div class=\"mtr-cell-content\"> 7 <\/div><\/td><td class=\"mtr-td-tag\" data-tve-custom-colour=\"48971731\" data-mtr-content=\"Description\"><div class=\"mtr-cell-content\">\u4e0d<\/div><\/td><\/tr><\/tbody><\/table><h2>\u5728 Excel \u4e2d\u4f7f\u7528 VBA \u6d88\u606f\u6846\u51fd\u6570\u7684\u771f\u5b9e\u793a\u4f8b<\/h2><p>\u8fd9\u91cc\u6211\u5217\u51fa\u4e86\u4e00\u4e9b\u73b0\u5b9e\u751f\u6d3b\u4e2d\u7684 VBA \u6d88\u606f\u6846\u793a\u4f8b\uff0c\u6211\u76f8\u4fe1\u8fd9\u4e9b\u793a\u4f8b\u4f1a\u5bf9\u60a8\u7684\u4f7f\u7528\u6709\u6240\u542f\u53d1\u3002 <\/p><h3 style=\"font-size: 22px; margin-bottom: 15px !important; margin-top: 0px !important;\" data-fontsize=\"18\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-lineheight=\"27\"> #1.\u4f7f\u7528 VBA MsgBox \u6267\u884c\u5b8f<\/h3><p>\u73b0\u5728\uff0c\u501f\u52a9 msgbox \u51fd\u6570\uff0c\u60a8\u53ef\u4ee5\u5728\u8fd0\u884c\u5b8f\u4e4b\u524d\u63d0\u793a\u7528\u6237\u3002\u6211\u4eec\u770b\u4e0b\u9762\u7684\u5b8f\u5c31\u53ef\u4ee5\u7406\u89e3\u4e86\u3002<\/p><p>\u5728 SaveThis() \u4e0b<\/p><p>\u5c06\u7ed3\u679c\u6697\u6de1\u4e3a\u6574\u6570<\/p><p>Result = MsgBox(\u201c\u4f60\u60f3\u4fdd\u5b58\u8fd9\u4e2a\u6587\u4ef6\u5417\uff1f\u201d, vbOKCancel)<\/p><p>\u5982\u679c\u7ed3\u679c = vbOK \u90a3\u4e48<\/p><p>\u6d3b\u52a8\u5de5\u4f5c\u7c3f.\u4fdd\u5b58<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/enregistrer-le-classeur-avec-vba-msgbox.png\" sizes=\"auto, \" srcset=\"\" alt=\"\u4f7f\u7528 vba msgbox \u4fdd\u5b58\u5de5\u4f5c\u7c3f\" width=\"237\" height=\"143\" data-attachment-id=\"14848\"><\/p><p>\u60a8\u53ef\u4ee5\u8981\u6c42\u7528\u6237\u4fdd\u5b58\u5de5\u4f5c\u7c3f\uff0c\u5982\u679c\u7528\u6237\u5355\u51fb\u201c\u786e\u5b9a\u201d\u6309\u94ae\uff0c\u5b8f\u4ee3\u7801\u5c06\u4fdd\u5b58\u5de5\u4f5c\u7c3f\u3002 <\/p><h3 style=\"margin-bottom: 15px !important; margin-top: 0px !important; font-size: 22px;\" data-fontsize=\"18\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-lineheight=\"27\"> #2.\u5c06\u8868\u683c\u63d2\u5165\u6d88\u606f\u6846<\/h3><p>\u60a8\u53ef\u4ee5\u4f7f\u7528 vbTab \u5728\u6d88\u606f\u6846\u4e2d\u8f93\u5165\u8868\u683c\u6570\u636e\u3002\u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u8868\u683c\u4ece\u5355\u5143\u683c A1 \u5f00\u59cb\u3002 <\/p><p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/ajouter-un-onglet-dans-vba-msgbox.png\" sizes=\"auto, \" srcset=\"\" alt=\"\" width=\"333\" height=\"308\" data-attachment-id=\"14850\"><\/p><p>\u5728 AddToMsgBox() \u4e0b<\/p><p>\u6697\u6de1\u6d88\u606f\u4f5c\u4e3a\u5b57\u7b26\u4e32<\/p><p>\u8c03\u6697 r \u4f5c\u4e3a int<\/p><p>\u5c06 c \u8c03\u6697\u4e3a int<\/p><p>\u5c06 rc \u8c03\u6697\u4e3a int<\/p><p>\u5c06 cc \u8c03\u6697\u4e3a int<\/p><p>\u5c06 myRows \u8c03\u6697\u4e3a\u8303\u56f4<\/p><p>\u5c06 myColumns \u8c03\u6697\u4e3a\u8303\u56f4<\/p><p>\u6d88\u606f=\u201c\u201d<\/p><p>\u8bbe\u7f6e myRows = Range(\u201cA:A\u201d)<\/p><p>\u8bbe\u7f6e myColumns = Range(\u201c1:1\u201d)<\/p><p> rc = Application.CountA(myRows)<\/p><p> cc = Application.CountA(myColumns)<\/p><p>\u5bf9\u4e8e r = 1 \u81f3 rc \u5bf9\u4e8e c = 1 \u81f3 cc<\/p><p> Msg = Msg &amp; Cells(r, c).Text<\/p><p>\u5982\u679c c &lt;= cc \u90a3\u4e48<\/p><p>\u6d88\u606f = \u6d88\u606f &amp; vbTab<\/p><p>\u4e0b\u4e00\u4e2a cmsg = Msg &amp; vbCrLf<\/p><p>\u4e0b\u4e00\u4e2a<\/p><p>\u6d88\u606f\u6846\u6d88\u606f<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h3 style=\"margin-bottom: 15px !important; margin-top: 0px !important; font-size: 22px;\" data-fontsize=\"18\" data-inline-fontsize=\"true\" data-inline-lineheight=\"true\" data-lineheight=\"27\"> \uff033\u3002\u6253\u5f00\u6587\u4ef6\u65f6\u663e\u793a\u6d88\u606f\u6846<\/h3><p>\u5982\u679c\u60a8\u67e5\u770b\u4e0b\u9762\u7684\u5b8f\uff0c\u6211\u4f7f\u7528 auto_open \u521b\u5efa\u4e00\u6761\u6d88\u606f\uff0c\u4ee5\u5728\u6253\u5f00\u5de5\u4f5c\u7c3f\u65f6\u663e\u793a\u3002<\/p><p>\u5728 auto_open() \u4e0b<\/p><p>MsgBox\u201c\u6b22\u8fce\u4f7f\u7528 Exceladvisor \u5e76\u611f\u8c22\u60a8\u4e0b\u8f7d\u6b64\u6587\u4ef6\u201d_<\/p><p> + vbNewLine + vbNewLine + \u300b\u8fd9\u91cc\u4f60\u4f1a\u627e\u5230MsgBox\u51fd\u6570\u7684\u8be6\u7ec6\u89e3\u91ca\u3002 \u00bb _<\/p><p> + vbNewLine + vbNewLine + \u201c\u800c\u4e14\uff0c\u4e0d\u8981\u5fd8\u8bb0\u67e5\u770b\u5176\u4ed6\u5f88\u9177\u7684\u4e1c\u897f\u3002 \u00bb<\/p><p>\u7ed3\u675f\u5b57\u5e55<\/p><h2 data-fontsize=\"26\" data-lineheight=\"39\">\u8981\u70b9<\/h2><ol><li>\u5982\u679c\u4e0d\u4f7f\u7528\u5e2e\u52a9\u6309\u94ae\u4f5c\u4e3a\u7b2c\u56db\u4e2a\u6309\u94ae\uff0c\u5219\u65e0\u6cd5\u5411\u6d88\u606f\u6846\u6dfb\u52a0\u56db\u4e2a\u6309\u94ae\u3002<\/li><li>\u8981\u4e3a\u6d88\u606f\u6846\u521b\u5efa\u5e2e\u52a9\u6587\u4ef6\uff0c\u60a8\u53ef\u4ee5\u53c2\u8003\u4ee5\u4e0b\u793a\u4f8b\u6587\u4ef6\u3002<\/li><\/ol><h2 data-fontsize=\"28\" data-lineheight=\"42\">\u793a\u4f8b\u6587\u4ef6<\/h2><p><a style=\"outline: none;\" spellcheck=\"false\" href=\"http:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/11\/msgbox.zip\" rel=\"nofollow\" data-wpel-link=\"internal\" data-ms-editor=\"true\">\u8bf7\u5728\u6b64\u5904\u4e0b\u8f7d\u6b64\u793a\u4f8b\u6587\u4ef6<\/a>\u4ee5\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\u3002<\/p><h2 data-fontsize=\"26\" data-lineheight=\"39\">\u7ed3\u8bba<\/h2><p>\u6d88\u606f\u6846\u4e0d\u4ec5\u53ef\u4ee5\u5e2e\u52a9\u60a8\u4f20\u8fbe\u6d88\u606f\uff0c\u8fd8\u53ef\u4ee5\u7ed9\u7528\u6237\u7559\u4e0b\u521b\u9020\u6027\u7684\u5370\u8c61\u3002\u60a8\u53ef\u4ee5\u5411\u4ed6\u4eec\u53d1\u9001\u6d88\u606f\u5e76\u83b7\u5f97\u7b80\u5355\u7684\u56de\u590d\u3002<\/p><p>\u5c31\u50cf\u6211\u8bf4\u7684\uff0c\u5982\u679c\u60a8\u662f VBA \u65b0\u624b\uff0c\u5b66\u4e60\u5982\u4f55\u4f7f\u7528\u6d88\u606f\u6846\u662f\u6700\u597d\u7684\u4e8b\u60c5\u4e4b\u4e00\u3002\u6211\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u53ef\u4ee5\u5e2e\u52a9\u60a8\u66f4\u63a5\u8fd1\u638c\u63e1 VBA \u7684\u68a6\u60f3\uff0c\u4f46\u73b0\u5728\u544a\u8bc9\u6211\u4e00\u4ef6\u4e8b\u3002<\/p><p><em>\u60a8\u8ba4\u4e3a MsgBox \u51fd\u6570\u662f VBA \u4e2d\u6700\u9177\u7684\u529f\u80fd\u4e4b\u4e00\u5417\uff1f<\/em><\/p><p>\u8bf7\u52a1\u5fc5\u5728\u8bc4\u8bba\u90e8\u5206\u4e0e\u6211\u5206\u4eab\u60a8\u7684\u610f\u89c1\uff0c\u6211\u5f88\u4e50\u610f\u542c\u53d6\u60a8\u7684\u610f\u89c1\uff0c\u5e76\u4e14\u4e0d\u8981\u5fd8\u8bb0\u4e0e\u60a8\u7684\u670b\u53cb\u5206\u4eab\u6b64\u6280\u5de7\u3002<\/p><p><strong>\u4e86\u89e3\u6709\u5173 VBA \u7684\u66f4\u591a\u4fe1\u606f<\/strong><\/p><ul><li><a style=\"outline: none;\" href=\"https:\/\/exceladvisor.org\/cn\/\u6dfb\u52a0\u65b0\u5de5\u4f5c\u8868-1\/\" data-wpel-link=\"internal\">\u4f7f\u7528 VBA \u6dfb\u52a0\u5e26\u6709\u540d\u79f0\u7684\u65b0\u5de5\u4f5c\u8868<\/a><\/li><li> <a style=\"outline: none;\" href=\"https:\/\/exceladvisor.org\/cn\/\u5f55\u5236\u5b8f\/\" data-wpel-link=\"internal\">\u5982\u4f55\u5728Excel\u4e2d\u5f55\u5236\u5b8f<\/a><\/li><li><a style=\"outline: none;\" href=\"https:\/\/exceladvisor.org\/cn\/\u663e\u5f0f\u9009\u9879-2\/\" data-wpel-link=\"internal\">\u663e\u5f0f VBA \u9009\u9879<\/a><\/li><\/ul>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"ub_ctt_via":"","footnotes":""},"class_list":["post-366","page","type-page","status-publish","hentry"],"featured_image_src":null,"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5982\u4f55\u5728Excel\u4e2d\u521b\u5efa\u6d88\u606f\u6846\u51fd\u6570\uff1f<\/title>\n<meta name=\"description\" content=\"VBA MsgBox \u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5f39\u51fa\u7a97\u53e3\uff0c\u7528\u4e8e\u5411\u7528\u6237\u4f20\u9012\u6d88\u606f\u5e76\u83b7\u53d6\u7528\u6237\u7684\u54cd\u5e94\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/exceladvisor.org\/cn\/vba\u6d88\u606f\u6846\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5982\u4f55\u5728Excel\u4e2d\u521b\u5efa\u6d88\u606f\u6846\u51fd\u6570\uff1f\" \/>\n<meta property=\"og:description\" content=\"VBA MsgBox \u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5f39\u51fa\u7a97\u53e3\uff0c\u7528\u4e8e\u5411\u7528\u6237\u4f20\u9012\u6d88\u606f\u5e76\u83b7\u53d6\u7528\u6237\u7684\u54cd\u5e94\" \/>\n<meta property=\"og:url\" content=\"https:\/\/exceladvisor.org\/cn\/vba\u6d88\u606f\u6846\/\" \/>\n<meta property=\"og:site_name\" content=\"Excel Advisor\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-10T11:48:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/syntaxe-fonction-vba-msgbox.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/\",\"url\":\"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/\",\"name\":\"\u5982\u4f55\u5728Excel\u4e2d\u521b\u5efa\u6d88\u606f\u6846\u51fd\u6570\uff1f\",\"isPartOf\":{\"@id\":\"https:\/\/exceladvisor.org\/cn\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/syntaxe-fonction-vba-msgbox.png\",\"datePublished\":\"2023-10-31T18:23:37+00:00\",\"dateModified\":\"2023-12-10T11:48:56+00:00\",\"description\":\"VBA MsgBox \u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5f39\u51fa\u7a97\u53e3\uff0c\u7528\u4e8e\u5411\u7528\u6237\u4f20\u9012\u6d88\u606f\u5e76\u83b7\u53d6\u7528\u6237\u7684\u54cd\u5e94\",\"breadcrumb\":{\"@id\":\"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/#primaryimage\",\"url\":\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/syntaxe-fonction-vba-msgbox.png\",\"contentUrl\":\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/syntaxe-fonction-vba-msgbox.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u5bb6\",\"item\":\"https:\/\/exceladvisor.org\/cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5982\u4f55\u5728excel\u4e2d\u521b\u5efa\u6d88\u606f\u6846\u51fd\u6570\uff1f\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/exceladvisor.org\/cn\/#website\",\"url\":\"https:\/\/exceladvisor.org\/cn\/\",\"name\":\"Excel Advisor\",\"description\":\"\u60a8\u7684\u6570\u636e\u7edf\u6cbb\u7ec8\u6781\u6307\u5357\",\"publisher\":{\"@id\":\"https:\/\/exceladvisor.org\/cn\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/exceladvisor.org\/cn\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/exceladvisor.org\/cn\/#organization\",\"name\":\"Excel Advisor\",\"url\":\"https:\/\/exceladvisor.org\/cn\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/exceladvisor.org\/cn\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/exceladvisor.org\/cn\/wp-content\/uploads\/2023\/12\/exceladvisor.org_.png\",\"contentUrl\":\"https:\/\/exceladvisor.org\/cn\/wp-content\/uploads\/2023\/12\/exceladvisor.org_.png\",\"width\":105,\"height\":36,\"caption\":\"Excel Advisor\"},\"image\":{\"@id\":\"https:\/\/exceladvisor.org\/cn\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5982\u4f55\u5728Excel\u4e2d\u521b\u5efa\u6d88\u606f\u6846\u51fd\u6570\uff1f","description":"VBA MsgBox \u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5f39\u51fa\u7a97\u53e3\uff0c\u7528\u4e8e\u5411\u7528\u6237\u4f20\u9012\u6d88\u606f\u5e76\u83b7\u53d6\u7528\u6237\u7684\u54cd\u5e94","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/exceladvisor.org\/cn\/vba\u6d88\u606f\u6846\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5982\u4f55\u5728Excel\u4e2d\u521b\u5efa\u6d88\u606f\u6846\u51fd\u6570\uff1f","og_description":"VBA MsgBox \u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5f39\u51fa\u7a97\u53e3\uff0c\u7528\u4e8e\u5411\u7528\u6237\u4f20\u9012\u6d88\u606f\u5e76\u83b7\u53d6\u7528\u6237\u7684\u54cd\u5e94","og_url":"https:\/\/exceladvisor.org\/cn\/vba\u6d88\u606f\u6846\/","og_site_name":"Excel Advisor","article_modified_time":"2023-12-10T11:48:56+00:00","og_image":[{"url":"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/syntaxe-fonction-vba-msgbox.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/","url":"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/","name":"\u5982\u4f55\u5728Excel\u4e2d\u521b\u5efa\u6d88\u606f\u6846\u51fd\u6570\uff1f","isPartOf":{"@id":"https:\/\/exceladvisor.org\/cn\/#website"},"primaryImageOfPage":{"@id":"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/#primaryimage"},"image":{"@id":"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/#primaryimage"},"thumbnailUrl":"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/syntaxe-fonction-vba-msgbox.png","datePublished":"2023-10-31T18:23:37+00:00","dateModified":"2023-12-10T11:48:56+00:00","description":"VBA MsgBox \u662f\u4e00\u4e2a\u7b80\u5355\u7684\u5f39\u51fa\u7a97\u53e3\uff0c\u7528\u4e8e\u5411\u7528\u6237\u4f20\u9012\u6d88\u606f\u5e76\u83b7\u53d6\u7528\u6237\u7684\u54cd\u5e94","breadcrumb":{"@id":"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/#primaryimage","url":"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/syntaxe-fonction-vba-msgbox.png","contentUrl":"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/syntaxe-fonction-vba-msgbox.png"},{"@type":"BreadcrumbList","@id":"https:\/\/exceladvisor.org\/cn\/vba%e6%b6%88%e6%81%af%e6%a1%86\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u5bb6","item":"https:\/\/exceladvisor.org\/cn\/"},{"@type":"ListItem","position":2,"name":"\u5982\u4f55\u5728excel\u4e2d\u521b\u5efa\u6d88\u606f\u6846\u51fd\u6570\uff1f"}]},{"@type":"WebSite","@id":"https:\/\/exceladvisor.org\/cn\/#website","url":"https:\/\/exceladvisor.org\/cn\/","name":"Excel Advisor","description":"\u60a8\u7684\u6570\u636e\u7edf\u6cbb\u7ec8\u6781\u6307\u5357","publisher":{"@id":"https:\/\/exceladvisor.org\/cn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/exceladvisor.org\/cn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Organization","@id":"https:\/\/exceladvisor.org\/cn\/#organization","name":"Excel Advisor","url":"https:\/\/exceladvisor.org\/cn\/","logo":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/exceladvisor.org\/cn\/#\/schema\/logo\/image\/","url":"https:\/\/exceladvisor.org\/cn\/wp-content\/uploads\/2023\/12\/exceladvisor.org_.png","contentUrl":"https:\/\/exceladvisor.org\/cn\/wp-content\/uploads\/2023\/12\/exceladvisor.org_.png","width":105,"height":36,"caption":"Excel Advisor"},"image":{"@id":"https:\/\/exceladvisor.org\/cn\/#\/schema\/logo\/image\/"}}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/exceladvisor.org\/cn\/wp-json\/wp\/v2\/pages\/366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/exceladvisor.org\/cn\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/exceladvisor.org\/cn\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/exceladvisor.org\/cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/exceladvisor.org\/cn\/wp-json\/wp\/v2\/comments?post=366"}],"version-history":[{"count":1,"href":"https:\/\/exceladvisor.org\/cn\/wp-json\/wp\/v2\/pages\/366\/revisions"}],"predecessor-version":[{"id":1166,"href":"https:\/\/exceladvisor.org\/cn\/wp-json\/wp\/v2\/pages\/366\/revisions\/1166"}],"wp:attachment":[{"href":"https:\/\/exceladvisor.org\/cn\/wp-json\/wp\/v2\/media?parent=366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}