Enable CommandButton1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
Terri,

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

Dave
 
Dave,
It does...it still doesn't change the properties for CommandButton1.
Thank so much for your help,
Terri
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top