+ Reply to Thread
Results 1 to 10 of 10

Alignment of CommanButton, button drift?

  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.

    Please Login or Register  to view this content.
    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

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Alignment of CommanButton, button drift?

    I can't reproduce your problem using:

    Please Login or Register  to view this content.



  3. #3
    Registered User
    Join Date
    12-17-2010
    Location
    The D
    MS-Off Ver
    Excel 2007
    Posts
    23

    Cool Re: Alignment of CommanButton, button drift?

    I thought there might be difficulty reproducing the abnormality since it works fine in the sample workbook that I had attached. However, this is not an isolated (to one worksheet) instance and if you were able to look at the image inside the sample workbook you can clearly see there is a problem. Aside from uploading my entire project do you have any other ideas of what to try? I'm willing to put in a few more hours ...

    Quote Originally Posted by snb View Post
    I can't reproduce your problem using:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-17-2010
    Location
    The D
    MS-Off Ver
    Excel 2007
    Posts
    23

    Exclamation Re: Alignment of CommanButton, button drift?

    I have been able to isolate and reproduce this in an small example and is attached for review. Your help is greatly appreciated.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-17-2010
    Location
    The D
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Alignment of CommanButton, button drift?

    I have provided the document in *.xls format for review. I appreciate any help as this is really an elusive problem.
    Attached Files Attached Files
    Last edited by e.good; 02-02-2011 at 12:22 AM. Reason: incorrect file attached

  6. #6
    Registered User
    Join Date
    12-17-2010
    Location
    The D
    MS-Off Ver
    Excel 2007
    Posts
    23

    Red face Re: Alignment of CommanButton, button drift?

    I realize I accidentally uploaded the incorrect file in which this can be reproduced. The correct one is attached here.
    Attached Files Attached Files

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Alignment of CommanButton, button drift?

    Both of those files simply error repeatedly for me. Is there a reason you need to use ActiveX controls - they are not as stable as Forms controls generally.
    Remember what the dormouse said
    Feed your head

  8. #8
    Registered User
    Join Date
    12-17-2010
    Location
    The D
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Alignment of CommanButton, button drift?

    Quote Originally Posted by romperstomper View Post
    Both of those files simply error repeatedly for me. Is there a reason you need to use ActiveX controls - they are not as stable as Forms controls generally.
    romperstomper - I will look into your suggestion and see if I can still reach my objective with Forms.

    Thanks, I'll let you know.

    UPDATE:
    After considering this, I see the Toggle is available only as an ActiveX implement. So that would have to be my first decisions from a design standpoint.
    Last edited by e.good; 02-04-2011 at 01:07 PM.

  9. #9
    Registered User
    Join Date
    12-17-2010
    Location
    The D
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Alignment of CommanButton, button drift?

    I have attached an update with suggestions from snb. However, I am still getting the "shift" in button location.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    12-17-2010
    Location
    The D
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Alignment of CommanButton, button drift?

    I have not been able to find the cause of the problem I described (and example provided) on this thread. After careful testing on a separate workbook, I am convinced there is nothing wrong with the coding itself.

    I suspect the problem has to do with some formatting or that my source files are created in a foreign language version of Excel. My fix has been to work around the source data that I receive by copying the data and formats from each sheet onto a new sheet and then deleting the original (with macro's of course). Not elegant, but it works and I only have deal with it 2-3 times a year.

    In my mind this is not SOLVED but CLOSED. Thank you to those who offered suggestions. Great forum!

+ Reply to Thread

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