{"id":3636,"date":"2023-08-27T22:27:47","date_gmt":"2023-08-27T14:27:47","guid":{"rendered":"https:\/\/www.bytetape.com\/?p=3636"},"modified":"2023-09-01T22:48:06","modified_gmt":"2023-09-01T14:48:06","slug":"%e5%88%9b%e5%bb%ba%e4%b8%80%e4%b8%aa%e7%a5%9e%e7%a7%98%e5%af%86%e7%a0%81%e4%bf%9d%e7%ae%a1%e5%ae%a4%ef%bc%9a%e7%94%a8vba%e9%9a%90%e8%97%8f%e4%bd%a0%e7%9a%84%e5%af%86%e7%a0%81","status":"publish","type":"post","link":"https:\/\/www.bytetape.com\/?p=3636","title":{"rendered":"\u521b\u5efa\u4e00\u4e2a\u795e\u79d8\u5bc6\u7801\u4fdd\u7ba1\u5ba4\uff1a\u7528VBA\u9690\u85cf\u4f60\u7684\u5bc6\u7801"},"content":{"rendered":"\n<p>\u5927\u5bb6\u597d\uff01\u6b22\u8fce\u6765\u5230\u6211\u7684\u535a\u5ba2\uff01\u4eca\u5929\u6211\u8981\u4e0e\u5927\u5bb6\u5206\u4eab\u4e00\u4e2a\u6709\u8da3\u4e14\u5b9e\u7528\u7684\u5c0f\u6280\u5de7\uff0c\u901a\u8fc7\u4f7f\u7528VBA\u4ee3\u7801\uff0c\u6211\u4eec\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u9690\u85cf\u7684\u540d\u79f0\uff0c\u7528\u6765\u4fdd\u5b58\u5bc6\u7801\u3002\u4e0d\u4ec5\u5982\u6b64\uff0c\u6211\u8fd8\u4f1a\u5728\u6587\u7ae0\u672b\u5c3e\u5206\u4eab\u5b8c\u6574\u7684\u4ee3\u7801\uff0c\u8ba9\u4f60\u80fd\u591f\u8f7b\u677e\u5b9e\u73b0\u8fd9\u4e2a\u529f\u80fd\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e3a\u4ec0\u4e48\u9009\u62e9\u9690\u85cf\u540d\u79f0\uff1f<\/h2>\n\n\n\n<p>\u4f60\u53ef\u80fd\u4f1a\u60f3\uff0c\u4e3a\u4ec0\u4e48\u8981\u7528\u9690\u85cf\u540d\u79f0\u6765\u4fdd\u5b58\u5bc6\u7801\u5462\uff1f\u8fd9\u662f\u56e0\u4e3a\u9690\u85cf\u540d\u79f0\u53ef\u4ee5\u5728Excel\u5de5\u4f5c\u7c3f\u4e2d\u521b\u5efa\u4e00\u4e2a\u770b\u4f3c\u666e\u901a\u5374\u53c8\u4e0d\u6613\u88ab\u5bdf\u89c9\u7684\u5b58\u50a8\u7a7a\u95f4\uff0c\u5c06\u4f60\u7684\u5bc6\u7801\u5b89\u5168\u5730\u4fdd\u5b58\u5176\u4e2d\u3002\u4f7f\u7528VBA\u4ee3\u7801\uff0c\u6211\u4eec\u53ef\u4ee5\u8fdb\u4e00\u6b65\u52a0\u5f3a\u8fd9\u4e2a\u4fdd\u5bc6\u63aa\u65bd\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5f00\u59cb\u7f16\u5199VBA\u4ee3\u7801<\/h2>\n\n\n\n<p>\u8ba9\u6211\u4eec\u5f00\u59cb\u52a8\u624b\u7f16\u5199VBA\u4ee3\u7801\u5427\uff01\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u7528\u6765\u521b\u5efa\u4e00\u4e2a\u9690\u85cf\u540d\u79f0\u5e76\u9a8c\u8bc1\u8f93\u5165\u7684\u5bc6\u7801\u662f\u5426\u6b63\u786e\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Sub PassWord()\n    Dim sUserInput As String\n   \n    sUserInput = InputBox(\"\u8bf7\u8f93\u5165\u5bc6\u7801\")\n    Names.Add Name:=\"Password\", RefersTo:=\"1234567\", Visible:=False\n    If sUserInput = [PassWord] Then MsgBox \"\u5bc6\u7801\u6b63\u786e\uff01\" Else MsgBox \"\u5bc6\u7801\u9519\u8bef\uff01\"\nEnd Sub<\/pre>\n\n\n\n<p>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u9996\u5148\u4f7f\u7528 <code>InputBox<\/code> \u51fd\u6570\u83b7\u53d6\u7528\u6237\u8f93\u5165\u7684\u5bc6\u7801\u3002\u7136\u540e\uff0c\u6211\u4eec\u4f7f\u7528 <code>Names.Add<\/code> \u65b9\u6cd5\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a\u201cPassword\u201d\u7684\u9690\u85cf\u540d\u79f0\uff0c\u5c06\u5bc6\u7801\u201c1234567\u201d\u4e0e\u5176\u5173\u8054\uff0c\u5e76\u5c06\u5176\u8bbe\u7f6e\u4e3a\u4e0d\u53ef\u89c1\u3002\u6700\u540e\uff0c\u6211\u4eec\u68c0\u67e5\u7528\u6237\u8f93\u5165\u7684\u5bc6\u7801\u662f\u5426\u4e0e\u9690\u85cf\u540d\u79f0\u4e2d\u7684\u5bc6\u7801\u5339\u914d\uff0c\u5982\u679c\u5339\u914d\u5219\u663e\u793a\u201c\u5bc6\u7801\u6b63\u786e\uff01\u201d\uff0c\u5426\u5219\u663e\u793a\u201c\u5bc6\u7801\u9519\u8bef\uff01\u201d\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u9a8c\u4e00\u4e0b\u5427\uff01<\/h2>\n\n\n\n<p>\u73b0\u5728\uff0c\u4f60\u53ef\u4ee5\u5728Excel\u4e2d\u6309\u4e0b <code>ALT + F11<\/code> \u6253\u5f00VBA\u7f16\u8f91\u5668\uff0c\u5c06\u4e0a\u9762\u7684\u4ee3\u7801\u7c98\u8d34\u8fdb\u53bb\u3002\u63a5\u7740\uff0c\u4f60\u53ef\u4ee5\u5728VBA\u7f16\u8f91\u5668\u4e2d\u6267\u884c\u8fd9\u4e2a\u5b8f\uff0c\u5c1d\u8bd5\u8f93\u5165\u4e0d\u540c\u7684\u5bc6\u7801\uff0c\u770b\u770b\u662f\u4e0d\u662f\u80fd\u591f\u6210\u529f\u9a8c\u8bc1\u5bc6\u7801\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5c0f\u7ed3<\/h2>\n\n\n\n<p>\u901a\u8fc7\u4f7f\u7528VBA\u4ee3\u7801\uff0c\u6211\u4eec\u53ef\u4ee5\u5728Excel\u4e2d\u521b\u5efa\u4e00\u4e2a\u9690\u85cf\u540d\u79f0\uff0c\u5c06\u5bc6\u7801\u5b89\u5168\u5730\u50a8\u5b58\u8d77\u6765\u3002\u8fd9\u662f\u4e00\u4e2a\u65e2\u6709\u8da3\u53c8\u5b9e\u7528\u7684\u6280\u5de7\uff0c\u5e0c\u671b\u5927\u5bb6\u80fd\u591f\u559c\u6b22\uff01\u8bb0\u5f97\u5c06\u4ee3\u7801\u590d\u5236\u5230VBA\u7f16\u8f91\u5668\u4e2d\uff0c\u4eb2\u81ea\u4f53\u9a8c\u4e00\u4e0b\u5427\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u5bb6\u597d\uff01\u6b22\u8fce\u6765\u5230\u6211\u7684\u535a\u5ba2\uff01\u4eca\u5929\u6211\u8981\u4e0e\u5927\u5bb6&#8230; <\/p>\n","protected":false},"author":1,"featured_media":3638,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[40],"tags":[36,56,55,57],"class_list":["post-3636","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vba","tag-vba","tag-56","tag-55","tag-57"],"_links":{"self":[{"href":"https:\/\/www.bytetape.com\/index.php?rest_route=\/wp\/v2\/posts\/3636","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bytetape.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bytetape.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bytetape.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bytetape.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3636"}],"version-history":[{"count":1,"href":"https:\/\/www.bytetape.com\/index.php?rest_route=\/wp\/v2\/posts\/3636\/revisions"}],"predecessor-version":[{"id":3639,"href":"https:\/\/www.bytetape.com\/index.php?rest_route=\/wp\/v2\/posts\/3636\/revisions\/3639"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bytetape.com\/index.php?rest_route=\/wp\/v2\/media\/3638"}],"wp:attachment":[{"href":"https:\/\/www.bytetape.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3636"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bytetape.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3636"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bytetape.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3636"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}