{"id":1293,"date":"2023-04-21T14:23:38","date_gmt":"2023-04-21T14:23:38","guid":{"rendered":"https:\/\/262235.xyz\/?p=1293"},"modified":"2023-04-21T14:23:38","modified_gmt":"2023-04-21T14:23:38","slug":"1293","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2023\/04\/21\/1293\/","title":{"rendered":"CorelDRAW VBA \u7ed9\u7269\u4ef6\u8bbe\u7f6e\u540d\u79f0"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2022\/04\/2235738865.webp\" alt=\"\" title=\"\"><\/p>\n<h2>CorelDRAW VBA \u7ed9\u7269\u4ef6\u8bbe\u7f6e\u540d\u79f0<\/h2>\n<pre><code>Public Function SetNames()\n  Dim ssr As ShapeRange\n  Set ssr = ActiveSelectionRange\n\n#If VBA7 Then\n  ssr.Sort \" @shape1.left&lt;@shape2.left\"\n#Else\n' X4 \u4e0d\u652f\u6301 ShapeRange.sort\n#End If\n\n  Dim text As String\n  Dim lines() As String\n  ' \u63d0\u53d6\u6587\u672c\u4fe1\u606f\uff0c\u5207\u5272\u6587\u672c\n  If ssr(1).Type = cdrTextShape Then\n    If ssr(1).text.Type = cdrArtistic Then\n      text = ssr(1).text.Story.text\n      lines = Split(text, vbCr)\n      ssr.Remove 1\n  #If VBA7 Then\n      ssr.Sort \" @shape1.top&gt;@shape2.top\"\n  #Else\n  ' X4 \u4e0d\u652f\u6301 ShapeRange.sort\n  #End If\n    End If\n  Else\n      MsgBox \"\u8bf7\u628a\u591a\u884c\u6587\u672c\u653e\u6700\u5de6\u8fb9\"\n      Exit Function\n  End If\n\n' Debug.Print ssr.Count, UBound(lines), LBound(lines)\n' \u7ed9\u7269\u4ef6\u8bbe\u7f6e\u540d\u79f0\uff0c\u7528\u5904:\u6279\u91cf\u5bfc\u51fa\u53ef\u4ee5\u6709\u4e00\u4e2a\u540d\u79f0\n  i = 0\n  If ssr.Count &lt;= UBound(lines) + 1 Then\n    For Each s In ssr\n      s.Name = lines(i)\n      i = i + 1\n    Next s\n  End If\n\n  If ssr.Count &lt;&gt; UBound(lines) + 1 Then MsgBox \"\u6587\u672c\u884c:\" &amp; (UBound(lines) + 1) &amp; vbNewLine &amp; \"\u53f3\u8fb9\u7269\u4ef6:\" &amp; ssr.Count\n\nEnd Function<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>CorelDRAW VBA \u7ed9\u7269\u4ef6\u8bbe\u7f6e\u540d\u79f0 Public Function SetNames() D [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[67],"class_list":["post-1293","post","type-post","status-publish","format-standard","hentry","category-learn","tag-vba"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1293","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=1293"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1293\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}