{"id":1538,"date":"2024-01-26T08:15:33","date_gmt":"2024-01-26T00:15:33","guid":{"rendered":"https:\/\/lyvba.com\/?p=1538"},"modified":"2024-01-26T08:15:33","modified_gmt":"2024-01-26T00:15:33","slug":"coreldraw-vba-text01","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2024\/01\/26\/coreldraw-vba-text01\/","title":{"rendered":"CorelDRAW VBA\u63d2\u4ef6: \u6587\u672c\u7edf\u8ba1\u529f\u80fd  \u6e90\u7801\u89e3\u6790  \u89c6\u9891\u8bb2\u89e3"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2024\/01\/code.jpg\" alt=\"\" \/><\/p>\n<h2>\u3010CorelDRAW VBA\u63d2\u4ef6: \u6587\u672c\u7edf\u8ba1\u529f\u80fd  \u6e90\u7801\u89e3\u6790\u3011 B\u7ad9\u89c6\u9891<\/h2>\n<p><a href=\"https:\/\/www.bilibili.com\/video\/BV1164y1w7Tv\">https:\/\/www.bilibili.com\/video\/BV1164y1w7Tv<\/a><\/p>\n<h2>\u6e90\u7801<\/h2>\n<pre><code>Sub \u7edf\u8ba1\u6587\u672c()\n  Dim s As Shape, sr As ShapeRange\n  Set sr = ActiveSelectionRange\n\n  Dim d As Variant, str As String\n  Set d = CreateObject(&quot;Scripting.dictionary&quot;)\n\n   For Each s In sr\n    If s.Type = cdrTextShape Then\n      str = s.text.Story.text\n      If d.Exists(str) = True Then\n        d.Item(str) = d.Item(str) + 1\n      Else\n        d.Add str, 1\n      End If\n    End If\n  Next s\n\n  str = &quot;\u6587  \u672c&quot; &amp; vbTab &amp; vbTab &amp; &quot;\u6570\u91cf&quot; &amp; vbNewLine\n  a = d.keys: b = d.items\n  For i = 0 To d.Count - 1\n    str = str &amp; a(i) &amp; vbTab &amp; b(i) &amp; &quot;\u6761&quot; &amp; vbNewLine\n  Next\n  str = str &amp; &quot;\u5408\u8ba1\u603b\u91cf:&quot; &amp; vbTab &amp; vbTab &amp; d.Count &amp; &quot;\u6761&quot; &amp; vbNewLine\n\n  Debug.Print str\n  ActiveDocument.Unit = cdrMillimeter\n\n  Dim s1 As Shape\n  x = sr.FirstShape.LeftX - 100\n  y = sr.FirstShape.TopY\n  Set s1 = ActiveLayer.CreateParagraphText(x, y, x + 90, y - 150, str, Font:=&quot;\u534e\u6587\u4e2d\u5b8b&quot;)\nEnd Sub\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u3010CorelDRAW VBA\u63d2\u4ef6: \u6587\u672c\u7edf\u8ba1\u529f\u80fd \u6e90\u7801\u89e3\u6790\u3011 B\u7ad9\u89c6\u9891 https:\/\/www.bi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1539,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[74,67],"class_list":["post-1538","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-learn","tag-coreldraw","tag-vba"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/comments?post=1538"}],"version-history":[{"count":1,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1538\/revisions"}],"predecessor-version":[{"id":1540,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1538\/revisions\/1540"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media\/1539"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}