Disable Form button

BMD44

Board Regular
Joined
Sep 25, 2019
Messages
72
I have included Button from 'Form controls' in Excel.

Now, I want the button to be disabled when I open the workbook.

I used below syntax, but it doesn't disable the button.

ActiveSheet.Shapes("Button 1").ControlFormat.Enabled = False

The same syntax works for Command button

ActiveSheet.Shapes("CommandButton1").ControlFormat.Enabled = False

Can any one please help how can we disable Form Controls - Button.

Thanks in advance
 
@Logit
Button 1 always shows the msgbox for me.
It is a known problem, although I'm not sure when it started happening.
 
Upvote 0

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
.
It works here.

Perhaps a difference in the Excel Version ?

BMD44 .. what version are you using ?

????
 
Upvote 0
Yes it is down to the version, but not sure when it started.
 
Upvote 0
.
Here is an edit to the existing macro that changes the Button Caption from "Enabled" to "Disabled" .

VBA Code:
Sub UserFrmButnNO()
    ActiveSheet.Shapes("Button 1").ControlFormat.Enabled = False
    Worksheets("sheet1").Shapes("Button 1").Select
    Selection.Characters.Text = "Disabled"
   
End Sub

Sub UserFrmButnYES()
    ActiveSheet.Shapes("Button 1").ControlFormat.Enabled = True
    Worksheets("sheet1").Shapes("Button 1").Select
    Selection.Characters.Text = "Enabled"
End Sub
Thanks much for the code. I see Button1 always shows msg even if it is disabled/enabled.
 
Upvote 0
Sorry the code won't work for your version of Excel. Suggest you try to hide the button as Fluff indicated or perhaps there is a method
of using a SHAPE to look like a button ? Maybe Excel 2016 will let you disable the shape or perform another measure on it.
 
Upvote 0
Sorry the code won't work for your version of Excel. Suggest you try to hide the button as Fluff indicated or perhaps there is a method
of using a SHAPE to look like a button ? Maybe Excel 2016 will let you disable the shape or perform another measure on it.
Thanks much Logit and Fluff for your prompt replies. Sorry to ask more,but want to know if using Command button will have any issue (as we can disable command button)
 
Upvote 0
Sometimes, an ActiveX button will cause unintended issues that vary without warning. Just go with it and see how you fare.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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