ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Enable CommandButton1 (https://www.excelbanter.com/excel-programming/362488-enable-commandbutton1.html)

Terri

Enable CommandButton1
 
Hello,
I have a spreadsheet with a CommandButton1. I have set the Enable
properties to False. I also have a macro in the file I want to use to Enable
the CommandButton1. I'm using the following code:
CommandButton1.Enabled = True
But it's not working to Enable CommandButton1. What have I done wrong?

Thank you so much for your help,
Terri

Leith Ross[_559_]

Enable CommandButton1
 

Hello Terri,

Here is code you need to Enable your Command Button. Remeber when
referencing the Command Button from to include the Worksheet in the
reference.

Public Sub EnableButton()

Dim CmdBtn1 As Object

Set CmdBtn1 = Worksheets("Sheet1").Shapes("CommandButton1")
CmdBtn1.ControlFormat.Enabled = True

End Sub


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=545719


ExcelDave

Enable CommandButton1
 
Terri,

Make sure the code you have written resides in the Worksheet code

Dave

"Terri" wrote:

Hello,
I have a spreadsheet with a CommandButton1. I have set the Enable
properties to False. I also have a macro in the file I want to use to Enable
the CommandButton1. I'm using the following code:
CommandButton1.Enabled = True
But it's not working to Enable CommandButton1. What have I done wrong?

Thank you so much for your help,
Terri


Terri

Enable CommandButton1
 
Dave,
It does...it still doesn't change the properties for CommandButton1.
Thank so much for your help,
Terri

"ExcelDave" wrote:

Terri,

Make sure the code you have written resides in the Worksheet code

Dave

"Terri" wrote:

Hello,
I have a spreadsheet with a CommandButton1. I have set the Enable
properties to False. I also have a macro in the file I want to use to Enable
the CommandButton1. I'm using the following code:
CommandButton1.Enabled = True
But it's not working to Enable CommandButton1. What have I done wrong?

Thank you so much for your help,
Terri


kounoike[_2_]

Enable CommandButton1
 
One way

if you deal with commandbutton directly from standard module
code like
sub commandbutton1test
Worksheets("yourname").CommandButton1.Enabled = False
end sub

Worksheets("yourname") is Commandbutton1 reside
so, change "yourname" and run the macro.

if you put CommandButton1.Enabled = False in WorkSheet module, i think
you need write some sub code looks like Worksheet method in Worksheet
module to operate from standard module.

keizi

"Terri" wrote in message
...
Hello,
I have a spreadsheet with a CommandButton1. I have set the Enable
properties to False. I also have a macro in the file I want to use to

Enable
the CommandButton1. I'm using the following code:
CommandButton1.Enabled = True
But it's not working to Enable CommandButton1. What have I done

wrong?

Thank you so much for your help,
Terri




All times are GMT +1. The time now is 07:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com