View Single Post
  #6   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

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

--
Regards,
Tom Ogilvy

"Paul James" wrote in message
...
Thanks for the reply, Bob.

The button I'm working with was created from the Forms toolbar, so I would
need to use the Button object.

I'm still looking for a way to "gray-out" the button, or provide some

other
visual cue when it's disabled. Any idea how to accomplish this?


"Bob Phillips" wrote in message
...
Paul,

Use this

worksheets("sheetName").oleobjects("cmdName").obje ct.enabled=false


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"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