简体   繁体   English

VBA Excel2007。在单元格中创建按钮

[英]VBA excel 2007. Create Button in cell

I'm creating a button with code 我正在用代码创建一个按钮

Set CreateButton = ActiveSheet.Buttons.Add _
                (C.Left, C.Top, C.Width, C.Height)

where C is Cell object. 其中C是Cell对象。 Button appears not in cell but little upper. 按钮出现在单元格中而不是上半部分。

CreateButton.Top is 107.25. CreateButton.Top是107.25。 And when I try to assign CreateButton.Top to itself, value is 114.75. 当我尝试为其分配CreateButton.Top时,值为114.75。 What is going on? 到底是怎么回事?

It appears to be related to the margins. 它似乎与边距有关。 I changed it around and got the button to move its relative position by changing the top margin. 我对其进行了更改,并获得了通过更改顶部边缘来移动其相对位置的按钮。 Like you it only happened when adding the button while in page layout mode. 像您一样,它仅在页面布局模式下添加按钮时发生。 In normal mode everything worked regardless of the margin. 在正常模式下,不管余量如何,一切正常。

You may be able to compensate with that information. 您也许可以用这些信息进行补偿。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM