{"id":55,"date":"2024-10-04T07:09:05","date_gmt":"2024-10-03T23:09:05","guid":{"rendered":"https:\/\/lilia-study.com\/lang\/eng\/?p=55"},"modified":"2024-10-07T06:54:36","modified_gmt":"2024-10-06T22:54:36","slug":"shape-heightwidth","status":"publish","type":"post","link":"https:\/\/lilia-study.com\/lang\/chs\/excel\/excel-vba\/shape\/shape-heightwidth\/","title":{"rendered":"Excel VBA \u8c03\u6574\u5de5\u4f5c\u8868\u56fe\u50cf\u5927\u5c0f-Height\u3001Width"},"content":{"rendered":"<p><!-- wp:html --><\/p>\n<p><span class=\"icon_point color01\"><\/span>&nbsp;\u672c\u6587\u7531\u65e5\u6587\u8bd1\u6210\u4e2d\u6587\u3002<\/p>\n<p><!-- \/wp:html --><\/p>\n\n\n\n\n<p>\u8fd9\u662f\u4f7f\u7528 Excel VBA \u8c03\u6574\u5de5\u4f5c\u8868\u4e2d\u56fe\u50cf\uff08\u81ea\u52a8\u8c03\u6574\uff09\u7684\u9ad8\u5ea6\u548c\u5bbd\u5ea6\u7684\u8bb0\u5f55\u3002<\/p>\n\n\n\n<p>\u9ad8\u5ea6\u4f7f\u7528 \u201cHeight&#8221; \u5c5e\u6027\uff0c\u5bbd\u5ea6\u4f7f\u7528 \u201cWidth&#8221; \u5c5e\u6027\u3002<\/p>\n\n\n\n<p>&#8220;LockAspectRatio&#8221;\uff08\u9501\u5b9a\u5bbd\u9ad8\u6bd4\uff09\u5c5e\u6027\u7528\u4e8e\u8bbe\u7f6e\u8981\u4fdd\u7559\u7684\u56fe\u50cf\u9ad8\u5ea6\u548c\u5bbd\u5ea6\u5c3a\u5bf8\u4e4b\u95f4\u7684\u6bd4\u4f8b\u3002<\/p>\n\n\n<p><!-- wp:html --><\/p>\n<p style=\"margin-bottom:0;padding-bottom:0;\">&lt;&nbsp;Sponsored Links&nbsp;&gt;<\/p>\n<p><script async=\"\" src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br \/>\n<!-- lilia top --><br \/>\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-4504956686889525\" data-ad-slot=\"2727563599\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins><br \/>\n<script>\n(adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><br \/>\n<!-- \/wp:html --><\/p>\n\n\n\n\n<h2 class=\"wp-block-heading\">\u8c03\u6574\u5de5\u4f5c\u8868\u56fe\u50cf\u5927\u5c0f\u7684\u793a\u4f8b<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u4fdd\u6301\u56fe\u50cf\u957f\u5bbd\u6bd4<\/h3>\n\n\n\n<p>\u5c06\u9ad8\u5ea6\u8bbe\u7f6e\u4e3a 200 \u70b9\uff0c\u540c\u65f6\u4fdd\u7559\u56fe\u50cf\u7684\u5bbd\u9ad8\u6bd4\u3002<\/p>\n\n\n\n<p class=\"p10 bdr_blue\">Sub test()<br>\n&nbsp;&nbsp;&nbsp;&nbsp;Dim shp As Shape<br>\n&nbsp;&nbsp;&nbsp;&nbsp;Set shp = ActiveSheet.Shapes(1)<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;With shp<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.LockAspectRatio = msoTrue<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Height = 200<br>\n&nbsp;&nbsp;&nbsp;&nbsp;End With<br>\nEnd Sub<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/08\/heightwidth01.png\" alt=\"\u753b\u50cf\u30b5\u30a4\u30ba\" class=\"wp-image-433\"\/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/08\/heightwidth02.png\" alt=\"\u753b\u50cf\u30b5\u30a4\u30ba\" class=\"wp-image-435\"\/><\/figure>\n<\/div>\n\n\n<p>\u3000<\/p>\n\n\n\n<p>\u5c06\u5bbd\u5ea6\u8bbe\u7f6e\u4e3a 200 \u70b9\uff0c\u540c\u65f6\u4fdd\u7559\u56fe\u50cf\u7684\u5bbd\u9ad8\u6bd4\u3002<\/p>\n\n\n\n<p class=\"p10 bdr_blue\">Sub test()<br>\n&nbsp;&nbsp;&nbsp;&nbsp;Dim shp As Shape<br>\n&nbsp;&nbsp;&nbsp;&nbsp;Set shp = ActiveSheet.Shapes(1)<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;With shp<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.LockAspectRatio = msoTrue<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Width = 200<br>\n&nbsp;&nbsp;&nbsp;&nbsp;End With<br>\nEnd Sub<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/08\/heightwidth03.png\" alt=\"\u753b\u50cf\u30b5\u30a4\u30ba\" class=\"wp-image-436\"\/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/08\/heightwidth04.png\" alt=\"\u753b\u50cf\u30b5\u30a4\u30ba\" class=\"wp-image-437\"\/><\/figure>\n<\/div>\n\n\n<p>\u3000<\/p>\n\n\n\n<p>\u5c06\u56fe\u50cf\u7684\u9ad8\u5ea6\u8bbe\u7f6e\u4e3a 2-6 \u884c\u9ad8\uff0c\u540c\u65f6\u4fdd\u7559\u56fe\u50cf\u7684\u5bbd\u9ad8\u6bd4\u3002<\/p>\n\n\n\n<p class=\"p10 bdr_blue\">Sub test()<br>\n&nbsp;&nbsp;&nbsp;&nbsp;Dim shp As Shape<br>\n&nbsp;&nbsp;&nbsp;&nbsp;Set shp = ActiveSheet.Shapes(1)<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;With shp<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.LockAspectRatio = msoTrue<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Height = ActiveSheet.Range(&#8220;2:6&#8221;).Height<br>\n&nbsp;&nbsp;&nbsp;&nbsp;End With<br>\nEnd Sub<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/08\/heightwidth05.png\" alt=\"\u753b\u50cf\u30b5\u30a4\u30ba\" class=\"wp-image-438\"\/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/08\/heightwidth06.png\" alt=\"\u753b\u50cf\u30b5\u30a4\u30ba\" class=\"wp-image-439\"\/><\/figure>\n<\/div>\n\n\n<p>\u3000<\/p>\n\n\n\n<p>\u5c06\u5bbd\u5ea6\u8bbe\u7f6e\u4e3a B-D \u5217\u7684\u5bbd\u5ea6\uff0c\u540c\u65f6\u4fdd\u7559\u56fe\u50cf\u7684\u5bbd\u9ad8\u6bd4\u3002<\/p>\n\n\n\n<p class=\"p10 bdr_blue\">Sub test()<br>\n&nbsp;&nbsp;&nbsp;&nbsp;Dim shp As Shape<br>\n&nbsp;&nbsp;&nbsp;&nbsp;Set shp = ActiveSheet.Shapes(1)<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;With shp<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.LockAspectRatio = msoTrue<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Width = ActiveSheet.Range(&#8220;B:D&#8221;).Width<br>\n&nbsp;&nbsp;&nbsp;&nbsp;End With<br>\nEnd Sub<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/08\/heightwidth07.png\" alt=\"\u753b\u50cf\u30b5\u30a4\u30ba\" class=\"wp-image-440\"\/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/08\/heightwidth08.png\" alt=\"\u753b\u50cf\u30b5\u30a4\u30ba\" class=\"wp-image-441\"\/><\/figure>\n<\/div>\n\n\n<p>\u3000<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e0d\u4fdd\u7559\u56fe\u50cf\u7684\u5bbd\u9ad8\u6bd4<\/h3>\n\n\n\n<p>\u56fe\u50cf\u7684\u5bbd\u9ad8\u6bd4\u4e0d\u4f1a\u4fdd\u7559\uff0c\u9ad8\u5ea6\u548c\u5bbd\u5ea6\u5747\u8bbe\u7f6e\u4e3a 100 \u70b9\u3002<\/p>\n\n\n\n<p class=\"p10 bdr_blue\">Sub test()<br>\n&nbsp;&nbsp;&nbsp;&nbsp;Dim shp As Shape<br>\n&nbsp;&nbsp;&nbsp;&nbsp;Set shp = ActiveSheet.Shapes(1)<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;With shp<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.LockAspectRatio = msoFalse<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Height = 100<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Width = 100<br>\n&nbsp;&nbsp;&nbsp;&nbsp;End With<br>\nEnd Sub<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/08\/heightwidth09.png\" alt=\"\u753b\u50cf\u30b5\u30a4\u30ba\" class=\"wp-image-442\"\/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/08\/heightwidth10.png\" alt=\"\u753b\u50cf\u30b5\u30a4\u30ba\" class=\"wp-image-443\"\/><\/figure>\n<\/div>\n\n\n<p>\u3000<\/p>\n\n\n\n<p>\u9ad8\u5ea6\u8bbe\u7f6e\u4e3a\u7b2c 2-6 \u884c\u7684\u9ad8\u5ea6\uff0c\u5bbd\u5ea6\u8bbe\u7f6e\u4e3a\u7b2c B-D \u5217\u7684\u5bbd\u5ea6\uff0c\u4f46\u4e0d\u4fdd\u7559\u56fe\u50cf\u7684\u7eb5\u6a2a\u6bd4\u3002<\/p>\n\n\n\n<p class=\"p10 bdr_blue\">Sub test()<br>\n&nbsp;&nbsp;&nbsp;&nbsp;Dim shp As Shape<br>\n&nbsp;&nbsp;&nbsp;&nbsp;Set shp = ActiveSheet.Shapes(1)<br>\n<br>\n&nbsp;&nbsp;&nbsp;&nbsp;With shp<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.LockAspectRatio = msoFalse<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Height = ActiveSheet.Range(&#8220;2:6&#8221;).Height<br>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Width = ActiveSheet.Range(&#8220;B:D&#8221;).Width<br>\n&nbsp;&nbsp;&nbsp;&nbsp;End With<br>\nEnd Sub<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/08\/heightwidth11.png\" alt=\"\u753b\u50cf\u30b5\u30a4\u30ba\" class=\"wp-image-444\"\/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/lilia-study.com\/wp-content\/uploads\/2020\/08\/heightwidth12.png\" alt=\"\u753b\u50cf\u30b5\u30a4\u30ba\" class=\"wp-image-445\"\/><\/figure>\n<\/div>\n\n<p><!-- wp:html --><\/p>\n<p style=\"margin-bottom:0;padding-bottom:0;\">&lt;&nbsp;Sponsored Links&nbsp;&gt;<\/p>\n<p><script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-4504956686889525\"\n     crossorigin=\"anonymous\"><\/script><br \/>\n<!-- lilia bottom --><br \/>\n<ins class=\"adsbygoogle\"\n     style=\"display:inline-block;width:336px;height:280px\"\n     data-ad-client=\"ca-pub-4504956686889525\"\n     data-ad-slot=\"7848928897\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><br \/>\n<!-- \/wp:html --><\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u662f\u4f7f\u7528 Excel VBA \u8c03\u6574\u5de5\u4f5c\u8868\u4e2d\u56fe\u50cf\uff08\u81ea\u52a8\u8c03\u6574\uff09\u7684\u9ad8\u5ea6\u548c\u5bbd\u5ea6\u7684\u8bb0\u5f55\u3002 \u9ad8\u5ea6\u4f7f\u7528 \u201cHeight&#8221; \u5c5e\u6027\uff0c\u5bbd\u5ea6\u4f7f\u7528 \u201cWidth&#8221; \u5c5e\u6027\u3002 &#8220;LockAspectRatio&#038;# [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,2,9],"tags":[],"class_list":{"0":"post-55","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-excel","7":"category-excel-vba","8":"category-shape"},"_links":{"self":[{"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/posts\/55","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/comments?post=55"}],"version-history":[{"count":0,"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/posts\/55\/revisions"}],"wp:attachment":[{"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/media?parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/categories?post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lilia-study.com\/lang\/chs\/wp-json\/wp\/v2\/tags?post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}