Disable form command buttons?

Foo_Man_Chu

Board Regular
Joined
Jul 22, 2010
Messages
79
I'm using excel 2010. Can anyone tell me if it is possible to disable a form command button so it will not be clickable? Thanks in advance.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try this:-
Code:
 ActiveSheet.Shapes("Button 8").OLEFormat.Object.Enabled = False
Mick
 
Upvote 0
Does this work with you?

On my test sheet it has no effect whatsoever. The button still works even if disabled. I think this is a major Excel 2010 bug. See also this forum:
http://answers.microsoft.com/en-us/...-via-vba/793de6e3-6c20-4706-876d-1421209aad98

My code:
Code:
Sub dis_enableSheet()
    With Sheets("Sheet1")
        If .Range("A2").Value = vbNullString Then
        .Range("A2").Value = "This Sheet has been disabled as it has been superseded."
   '             .Buttons("Button 2").Enabled = False
                .Shapes("Button 2").OLEFormat.Object.Enabled = False
                .Buttons("Button 2").Font.ColorIndex = 16
        Else
        .Range("A2").Value = ""
                .Buttons("Button 2").Enabled = True
                .Buttons("Button 2").Font.ColorIndex = 1
        End If
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,879
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top