Results 1 to 10 of 10

Alignment of CommanButton, button drift?

Threaded View

e.good Alignment of CommanButton,... 01-30-2011, 04:10 PM
snb Re: Alignment of... 01-30-2011, 04:27 PM
e.good Re: Alignment of... 01-30-2011, 07:55 PM
e.good Re: Alignment of... 01-30-2011, 09:43 PM
e.good Re: Alignment of... 01-31-2011, 09:03 PM
e.good Re: Alignment of... 02-02-2011, 12:21 AM
romperstomper Re: Alignment of... 02-02-2011, 06:32 AM
e.good Re: Alignment of... 02-02-2011, 04:02 PM
e.good Re: Alignment of... 02-02-2011, 04:03 PM
e.good Re: Alignment of... 02-16-2011, 07:40 PM
  1. #1
    Registered User
    Join Date
    12-17-2010
    Location
    The D
    MS-Off Ver
    Excel 2007
    Posts
    23

    Arrow Alignment of CommanButton, button drift?

    I am programmatically creating ActiveX command buttons (actually ToggleButton) using the following code that is working well in my test file (attached). The intent is to fill the cell with the button so that it aligns with other information on the sheet.

                Set cb = _
                    ActiveSheet.OLEObjects.Add(ClassType:="Forms.ToggleButton.1", _
                    Left:=rCell.Left, Top:=rCell.Top, Width:=rCell.Width, Height:=rCell.Height)
    
                With cb
                    .Placement = xlMoveAndSize
                    .LinkedCell = rCell.Address
                    With .Object
                        .BackColor = &H80C0FF
                        .BackStyle = fmBackStyleOpaque
                        .Caption = "Click"
                        .Value = False
                    End With
                End With
    However, when I take this code to my real project I find that the buttons do not align with the rows after a while. I've played around with the different .Placement constants but no difference. I've also looked at cell formatting and seems to have no effect. This occurs immediately after creating the buttons, there is no sheet formatting or activation of the buttons leading up to this behavior.

    Anyone know what's going on? Do you know if the CommandButtons need some buffer space between instances? Can they overlap?

    I have placed a screen shot of the problem in the attached file since images cannot be posted directly here. A picture speaks a thousand words...
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1