{"id":3261,"date":"2022-03-19T17:03:33","date_gmt":"2022-03-19T09:03:33","guid":{"rendered":"https:\/\/www.bytetape.com\/?p=3261"},"modified":"2023-09-03T11:37:07","modified_gmt":"2023-09-03T03:37:07","slug":"%e4%bb%a3%e7%a0%81%e8%bf%90%e8%a1%8c%e6%97%b6%e9%97%b4%e9%95%bf%ef%bc%9f%e6%9d%a5%e4%b8%aa%e8%bf%9b%e5%ba%a6%e6%9d%a1%e5%90%a7%ef%bc%81","status":"publish","type":"post","link":"https:\/\/www.bytetape.com\/?p=3261","title":{"rendered":"VBA-\u4e24\u79cd\u8fdb\u5ea6\u6761"},"content":{"rendered":"\n<p>\u7ed9\u5927\u5bb6\u63a8\u8350\u4e24\u79cd\u7b80\u5355\u7684\u8fdb\u5ea6\u6761\u663e\u793a\u65b9\u6cd5\uff0c\u66f4\u63a8\u8350\u7b2c\u4e00\u79cd\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/www.ixigua.com\/7274429330657116691?logTag=3d817643f386391d4f18\">https:\/\/www.ixigua.com\/7274429330657116691?logTag=3d817643f386391d4f18<\/a><\/p>\n\n\n\n<p><strong>\u65b9\u6cd5\u4e00\uff1a\u901a\u8fc7\u7a97\u4f53\u663e\u793a\u8fdb\u5ea6\u6761\uff08\u63a8\u8350\uff09<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.bytetape.com\/wp-content\/uploads\/2022\/03\/image-26.png\" alt=\"\" class=\"wp-image-3264\" style=\"width:296px;height:47px\" width=\"296\" height=\"47\" srcset=\"https:\/\/www.bytetape.com\/wp-content\/uploads\/2022\/03\/image-26.png 487w, https:\/\/www.bytetape.com\/wp-content\/uploads\/2022\/03\/image-26-300x47.png 300w\" sizes=\"auto, (max-width: 296px) 100vw, 296px\" \/><\/figure>\n\n\n\n<p>\u2460\u65b0\u5efa\u4e00\u4e2a\u7a7auserform\uff0c\u7c98\u8d34\u4e0b\u9762\u4ee3\u7801\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.bytetape.com\/wp-content\/uploads\/2022\/03\/image-25.png\" alt=\"\" class=\"wp-image-3263\" style=\"width:514px;height:210px\" width=\"514\" height=\"210\" srcset=\"https:\/\/www.bytetape.com\/wp-content\/uploads\/2022\/03\/image-25.png 964w, https:\/\/www.bytetape.com\/wp-content\/uploads\/2022\/03\/image-25-300x123.png 300w, https:\/\/www.bytetape.com\/wp-content\/uploads\/2022\/03\/image-25-768x315.png 768w\" sizes=\"auto, (max-width: 514px) 100vw, 514px\" \/><\/figure>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"visualbasic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Private Sub UserForm_Initialize()\n    Dim oLB As Control\n    With Me\n        .Height = 45\n        .Width = 254.25\n        Set oLB = .Controls.Add(\"Forms.label.1\", , True)\n        With oLB\n            .BackColor = H8000000D\n            .Height = 24\n        End With\n    End With\nEnd Sub<\/pre>\n\n\n\n<p>\u2461\u590d\u5236\u4e0b\u9762\u7684\u4ee3\u7801\u5230\u7a0b\u5e8f\u4e2d\u8c03\u7528\u3002\u6ce8\u610f\u4ee3\u7801\u4e2d\u7684\u201cUserForm1\u201d\u8bf7\u66f4\u6539\u4e3a\u521b\u5efa\u7684\u7a97\u4f53\u540d\u79f0\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"visualbasic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Sub main()\n    For i = 1 To 10\n        ProgressBar i, 10\n        inittimer = Timer: Do Until Timer - inittimer = 1: DoEvents: Loop\n    Next\nEnd Sub\n\nSub ProgressBar(Current As Variant, Total As Variant, Optional Title As String)\n    With UserForm1\n        .Caption = Title &amp; \"\u5df2\u5b8c\u6210\uff1a\" &amp; Current &amp; \"\/\" &amp; Total\n        !Label1.Width = Int(Current \/ Total * 252)\n        .Show vbModeless\n        DoEvents\n    End With\n    If Current = Total Then Unload UserForm1\nEnd Sub<\/pre>\n\n\n\n<p><strong>\u65b9\u6cd5\u4e8c\uff1a\u901a\u8fc7\u72b6\u6001\u680f\u663e\u793a\u8fdb\u5ea6\uff0c\u6ce8\u610f\u7a0b\u5e8f\u51fa\u73b0\u5361\u987f\u65f6\u4f1a\u65e0\u6cd5\u663e\u793a\u3002<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.bytetape.com\/wp-content\/uploads\/2022\/03\/image-27.png\" alt=\"\" class=\"wp-image-3265\" style=\"width:290px;height:22px\" width=\"290\" height=\"22\" srcset=\"https:\/\/www.bytetape.com\/wp-content\/uploads\/2022\/03\/image-27.png 421w, https:\/\/www.bytetape.com\/wp-content\/uploads\/2022\/03\/image-27-300x23.png 300w\" sizes=\"auto, (max-width: 290px) 100vw, 290px\" \/><\/figure>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"visualbasic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Sub main()\n    For i = 1 To 10\n        progressbar i, 10\n        inittimer = Timer: Do Until Timer - inittimer = 1: DoEvents: Loop\n    Next\nEnd Sub\n\nSub progressbar(Current As Variant, Total As Variant, Optional Title As String)\n    total_bar = 25  '\u8fdb\u5ea6\u6761\u603b\u6570\u91cf\n    Percent = Title &amp; \"\u5df2\u5b8c\u6210\uff1a\" &amp; Current &amp; \"\/\" &amp; Total\n    current_bar = Int(Current \/ Total * total_bar)\n    Application.DisplayStatusBar = True\n    Application.StatusBar = String(current_bar, \"\u2589\") _\n        &amp; String(total_bar - current_bar, \"\u2581\") &amp; \"\u258f\" &amp; Percent\n    If Current = Total Then\n        Application.StatusBar = False\n    End If\nEnd Sub<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7ed9\u5927\u5bb6\u63a8\u8350\u4e24\u79cd\u7b80\u5355\u7684\u8fdb\u5ea6\u6761\u663e\u793a\u65b9\u6cd5\uff0c\u66f4\u63a8&#8230; <\/p>\n","protected":false},"author":1,"featured_media":3270,"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":[47,36,49,48,44],"class_list":["post-3261","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vba","tag-userform","tag-vba","tag-49","tag-48","tag-44"],"_links":{"self":[{"href":"https:\/\/www.bytetape.com\/index.php?rest_route=\/wp\/v2\/posts\/3261","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=3261"}],"version-history":[{"count":14,"href":"https:\/\/www.bytetape.com\/index.php?rest_route=\/wp\/v2\/posts\/3261\/revisions"}],"predecessor-version":[{"id":3659,"href":"https:\/\/www.bytetape.com\/index.php?rest_route=\/wp\/v2\/posts\/3261\/revisions\/3659"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bytetape.com\/index.php?rest_route=\/wp\/v2\/media\/3270"}],"wp:attachment":[{"href":"https:\/\/www.bytetape.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3261"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bytetape.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3261"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bytetape.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}