简体   繁体   中英

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. Button appears not in cell but little upper.

CreateButton.Top is 107.25. And when I try to assign CreateButton.Top to itself, value is 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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