为什么不.Rows放置工作正常 [英] Why doesn't .Rows placement work properly

查看:51
本文介绍了为什么不.Rows放置工作正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在对象模型中,基于其属性,方法等的差异,似乎在工作表和工作表对象之间存在明显差异。

From the object model there appear to be obvious differences between Worksheet and Worksheets objects based upon the differences for their Properties, Methods, etc..

但是,即使工作表对象没有为其定义
属性,以下引用似乎也能正常工作:

However, the following references appears to work even though the Worksheets object does not have a Rows property defined for it:

工作表("Sheetx")。形状("Chartx")=工作表("Sheetx")。行(17)。顶部

Worksheets("Sheetx").Shapes("Chartx") = Worksheets("Sheetx").Rows(17).Top

我假设这是因为工作表("Sheetx")被解析为
工作表对象,其中定义了属性。

I am assuming this is because Worksheets("Sheetx") is resolved to being a Worksheet object, where the Rows property is defined.

但是,即使将图表对象的展示位置定义为行 17
顶部,也可以通过声明 图表的实际展示位置实际上是在
16 行的前一个图表之后立即发生。

However, even though the placement of the chart object is being defined to be the Top of row 17, by the statement, the actual placement of the chart actually occurs immediately after the previous chart on row 16.

我会有如果前一个图表底部出现在第16行的顶部或中间,则预计图表之间会有间隙,因为当前图表的顶部将被指向第17行。 

I would have expected there to be a gap between the charts if the previous chart bottom appears on the top or middle of row 16 since the top for the current chart is being directed to be on row 17. 

然而,正在观察的是,当前图表的顶部是在第16行的上一个图表之后立即发生的,尽管有指令在第17行进行。 
为什么忽略行顶部?

 

However, what is being observed is that the top of the current chart is occurring immediately after the previous chart on row 16, despite the directive to make it on row 17.  Why is the Row Top being ignored?
 

推荐答案

首先,Worksheets不是对象而是工作表对象的集合,因此它没有.Row属性。工作表("Sheetx")是工作表集合中的工作表,因此它具有.Row属性。

First off, Worksheets is not an object but a collection of worksheet objects, so it does not have a .Row property. Worksheets("Sheetx") is a worksheet within the collection of worksheets, so it does have a .Row property.

工作表("Sheetx")。形状(" Chartx") ).Top =工作表("Sheetx")。行(17)。顶部

Worksheets("Sheetx").Shapes("Chartx").Top = Worksheets("Sheetx").Rows(17).Top

按预期工作。


这篇关于为什么不.Rows放置工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆