You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Excel缩放工作表后获取图表高度时PlotArea.InsideHeight返回值不准确

Excel VBA PlotArea.InsideHeight 属性缩放场景取值异常说明
  • 需求背景:参考PlotArea.InsideHeight官方文档示例,计划通过该属性获取图表绘图区高度,在图表旁绘制尺寸匹配的Shape。
  • 异常表现:若近期调整过Excel窗口缩放比例,无论当前缩放值为多少,PlotArea.InsideHeight都会返回错误值,只有重新运行代码才能获取到正确数值。
  • 最小复现代码(运行前需确认环境中已存在chart_object对象):
Dim i
For Each i in Array(100, 85, 100, 115, 100)
    ActiveWindow.Zoom = i
    msgbox chart_object.Chart.PlotArea.InsideHeight
Next

运行上述代码后,弹出的消息框返回值会随缩放操作出现异常偏差,可证明PlotArea.InsideHeight属性在窗口缩放场景下的取值不可靠。

内容的提问来源于stack exchange,提问作者Alex Serenko

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.28 09:06:06