{"id":1020,"date":"2022-04-11T00:45:00","date_gmt":"2022-04-11T00:45:00","guid":{"rendered":"https:\/\/262235.xyz\/?p=1020"},"modified":"2022-04-11T00:45:00","modified_gmt":"2022-04-11T00:45:00","slug":"1020","status":"publish","type":"post","link":"https:\/\/lyvba.com\/index.php\/2022\/04\/11\/1020\/","title":{"rendered":"CorelDRAW VBA \u7f16\u7a0b\u5b66\u4e60\u7b14\u8bb0-\u526a\u8d34\u677f\u7269\u4ef6\u66ff\u6362\u811a\u672c"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/lyvba.com\/wp-content\/uploads\/2022\/04\/1569150005.webp\" alt=\"1744532390.webp\" title=\"1744532390.webp\"><\/p>\n<h2>\u5148\u5efa\u7acb\u4e00\u4e2a\u5b50\u7a0b\u5e8f\uff0c\u5f00\u542f\u4e00\u4e2aMsgBox\u5bf9\u8bdd\u6846\uff0c1 2 3 \u4e09\u4e2a\u5206\u652f\uff0c\u592a\u61d2\u4e86\uff0c\u76f4\u63a5\u4f7f\u7528  \u662f(Y) \u5426(N) \u53d6\u6d88\uff0c\u4e0d\u60f3\u81ea\u5df1\u5b9e\u73b0\u5bf9\u8bdd\u6846\uff0c\u76f4\u63a5\u7528 MsgBox\u5bf9\u8bdd\u6846<\/h2>\n<pre><code>Sub \u526a\u8d34\u677f\u7269\u4ef6\u66ff\u6362()\n  xz = MsgBox(\"\u4f7f\u526a\u8d34\u677f\u4e0a\u7684\u7269\u4ef6\u66ff\u6362\u9009\u62e9\u7684\u76ee\u6807\u7269\u4ef6\" &amp; vbNewLine &amp; vbNewLine &amp; \"\u70b9\u51fb \u662f(Y) \u76f4\u63a5\u66ff\u6362\u76ee\u6807\" &amp; vbNewLine &amp; _\n              \"\u70b9\u51fb \u5426(N) \u8c03\u6574\u5c3a\u5bf8\u548c\u76ee\u6807\u4e00\u6837\u5927\u5c0f\" &amp; vbNewLine &amp; \"\u70b9\u51fb \u53d6\u6d88  \u5b9e\u9645\u81ea\u52a8\u56fe\u7247\u66ff\u6362\u529f\u80fd!\", _\n              vbYesNoCancel, \"\u7528\u526a\u8d34\u677f\u4e0a\u7684\u7269\u4ef6\u66ff\u6362\u5bf9\u8c61\")\n\n  If xz = vbYes Then\n    Call copy_shape_replace\n  ElseIf xz = vbNo Then\n    Call copy_shape_replace_resize\n  ElseIf xz = vbCancel Then\n    Call image_replace\n  End If\nEnd Sub<\/code><\/pre>\n<h2>\u6e90\u7801\u5f88\u7b80\u5355\uff0c\u8fd9\u4e2a\u662f\u76f4\u63a5\u66ff\u6362\u7684 copy_shape_replace \u5206\u652f\uff0c\u5176\u4ed6\u4e24\u4e2a\u6309\u8fd9\u4e2a\u6837\u5b50\uff0c\u518d\u753b2\u4e2a\u846b\u82a6\u5c31\u53ef\u4ee5\u4e86<\/h2>\n<pre><code>Private Sub copy_shape_replace()\n  ActiveDocument.ReferencePoint = cdrCenter\n  Dim sh As Shape, shs As Shapes, cs As Shape\n  Dim x As Double, y As Double\n  Set shs = ActiveSelection.Shapes\n  cnt = 0\n  For Each sh In shs\n    If cnt = 0 Then\n      Set sc = ActiveDocument.ActiveLayer.Paste\n      cnt = 1\n    Else\n      sc.Duplicate 0, 0\n    End If\n    sh.GetPosition x, y\n    sc.SetPosition x, y\n    sh.Delete\n  Next sh\nEnd Sub<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u5efa\u7acb\u4e00\u4e2a\u5b50\u7a0b\u5e8f\uff0c\u5f00\u542f\u4e00\u4e2aMsgBox\u5bf9\u8bdd\u6846\uff0c1 2 3 \u4e09\u4e2a\u5206\u652f\uff0c\u592a\u61d2\u4e86\uff0c\u76f4\u63a5\u4f7f\u7528 \u662f(Y) \u5426( [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,12],"tags":[67],"class_list":["post-1020","post","type-post","status-publish","format-standard","hentry","category-soft","category-learn","tag-vba"],"_links":{"self":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1020","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=1020"}],"version-history":[{"count":0,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/posts\/1020\/revisions"}],"wp:attachment":[{"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/media?parent=1020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/categories?post=1020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyvba.com\/index.php\/wp-json\/wp\/v2\/tags?post=1020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}