+ Reply to Thread
Results 1 to 8 of 8

Disable command button not working in excel 2010

  1. #1
    Registered User
    Join Date
    11-08-2011
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    4

    Disable command button not working in excel 2010

    hi,
    I have a line in my code
    "Sheets("Front Graphs").Shapes("Button 2").ControlFormat.Enabled = False"

    This code is working in Excel 2007 But when i open same workbook in excel 2010,This does not work.
    Any clue??

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Disable command button not working in excel 2010

    I have found that with shapes you need to select them first.

    Maybe try:

    Please Login or Register  to view this content.
    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    11-08-2011
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Disable command button not working in excel 2010

    the problem is still same..I tried it but nothing happened.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Disable command button not working in excel 2010

    What type of control? Forms or ActiveX

    Not sure you can disable a Forms control.

    code for Activex without selection
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

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

    Re: Disable command button not working in excel 2010

    for formcontrols use:

    Please Login or Register  to view this content.
    @aboussetta

    I found the opposite: no selection necessary

    All these codes are equivalents:

    Please Login or Register  to view this content.
    Last edited by snb; 11-30-2011 at 06:51 AM.



  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Disable command button not working in excel 2010

    @snb, can you post an example because my testing of this on a forms control has now effect.

    Activex control when disabled has greyed out caption and can not be clicked with the forms button I am not seeing any difference in appearence or use.

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

    Re: Disable command button not working in excel 2010

    @Andy

    I could, but it would have no use, since I can't find any difference for formcontrols either.
    The only thing I can perceive is that the code works and changes that property using e.g.
    x2=sheets(1).buttons(1).enabled

    So maybe 'This code is working in Excel 2007' is true, but without any visual/factual result.

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Disable command button not working in excel 2010

    I've tried in '03/07/10. Whilst the code does not error it can not see it has any effect.

+ 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