+ Reply to Thread
Results 1 to 5 of 5

Disable button in VBA for Excel 2011

  1. #1
    Registered User
    Join Date
    01-25-2015
    Location
    Edmonton, AB
    MS-Off Ver
    Office for Mac 2011
    Posts
    3

    Disable button in VBA for Excel 2011

    I'm trying to disable a button in Excel 2011 using VBA. It doesn't seem to work. Apparently VBA for Excel 2010 (Windows) also had this bug.

    One solution I've found was to remove the macro from the button and grey out the text on the button to make it look disabled, then when I need it enabled again, re-hook-up the macro and change the text colour back. Again, this doesn't work (the macro switching works but not the greying out).

    Here's how I've done the disabling that originally didn't work:

    Please Login or Register  to view this content.
    Here's how I've tried to grey out the text on the button which also didn't work:

    Please Login or Register  to view this content.

    Any ideas how to make this work in Excel 2011 VBA? I've had to resort to .Visible = False and I hate it. I want to see the button, just disable it.

    Thanks so much!

  2. #2
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Disable button in VBA for Excel 2011

    Try;
    Please Login or Register  to view this content.
    Please click the * Add Reputation if this helps
    If solved remember to mark Thread as solved

    "I'm glad to help and this is not meant to sound smart, but either you have super-human vision to see all those controls cleared one by one with the code I posted, or your computer is really slow."

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Disable button in VBA for Excel 2011

    Hi ksignorini and Welcome to ExcelForum,

    Thank you for using CODE TAGS. It is much appreciated.

    A technique that works for me is to have two buttons superimposed on top of each other. Which Button is displayed can be controlled by either:
    a. Making One Button Visible and One Button Not Visible
    b. The Zorder Command which determines Which Button is on Top

    For more information on Zorder Enumerations see: https://msdn.microsoft.com/zh-cn/lib...ice.11%29.aspx

    This avoids having to play with the OnAction text.

    See the attached sample workbook and the code that follows:
    Please Login or Register  to view this content.
    Lewis

  4. #4
    Registered User
    Join Date
    01-25-2015
    Location
    Edmonton, AB
    MS-Off Ver
    Office for Mac 2011
    Posts
    3

    Re: Disable button in VBA for Excel 2011

    @Blokeman - Unfortunately, this doesn't seem to work either. Perhaps because I'm using 2011 for Mac?

  5. #5
    Registered User
    Join Date
    01-25-2015
    Location
    Edmonton, AB
    MS-Off Ver
    Office for Mac 2011
    Posts
    3

    Re: Disable button in VBA for Excel 2011

    Quote Originally Posted by LJMetzger View Post
    Hi ksignorini and Welcome to ExcelForum,

    Thank you for using CODE TAGS. It is much appreciated.

    A technique that works for me is to have two buttons superimposed on top of each other. Which Button is displayed can be controlled by either:

    Lewis - Thanks for the examples. I'll see if I can make this work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 12-01-2014, 06:01 AM
  2. Change the text color of a form button in Excel Mac 2011?!
    By RiTz21 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-09-2014, 06:25 PM
  3. Adding a Command Button on Excel 2011 for the Mac
    By ibabs in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-02-2013, 01:58 PM
  4. Add a permanent button to the toolbar for Excel 2011 for MAC
    By Gogia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-18-2012, 04:39 AM
  5. Disable the big X red button of Excel
    By Nicholas1978 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2012, 02:49 PM

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