View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default disabling a command button

You create buttons from the forms toolbar

worksheets("sheetName").Buttons("cmdName").enabled = false

you create commandbuttons from the Control toolbox toolbar

worksheets("sheetName").OleObjects("cmdName").enab led = false

--
Regards,
Tom Ogilvy


"Paul James" wrote in message
...
Is there any way to use VBA to disable or "gray-out" a command button in a
worksheet that was created from the Forms toolbar?

I tried using

worksheets("sheetName").shapes("cmdName").enabled = false

but I get an "object doesn't support this property or method" example.

I know I can turn the visible property on and off, but I'd rather have it
grayed out when it's not available so it's presence is still displayed.

Is there a way to accomplish this?

Thanks in advance,

Paul