I think there is a direct way to do what you want with that type of button,
but this kludge method seems to work as a substitute. Put this code line in
the Click event for the CommandButton on your UserForm...
Worksheets("Sheet1").Shapes("Button 1").TextFrame. _
Characters.Font.ColorIndex = 15
Change the worksheet reference and button name to those for your own
condition. Okay, that will change the button's font color to gray. Now, put
this line as the **FIRST** line in the macro assigned to the button
If Sheet1Shapes("Button 1").TextFrame.Characters. _
Font.ColorIndex = 15 Then Exit Sub
Again, change the worksheet reference and button name to those for your own
condition. If the button's font color is color index 15, the assigned macro
will exit before any code is executed... if the color index is any other
value, the macro code will run normally. This duplicates what happens when a
control is disabled and should suffice for your needs.
Rick
"ranswrt" <(E-Mail Removed)> wrote in message
news:433BACB0-B2AC-476E-B980-(E-Mail Removed)...
> It was put on with the forms toolbar.
>
> "Rick Rothstein (MVP - VB)" wrote:
>
>> If the button on the worksheet was an ActiveX button control from the
>> Control Toolbox toolbar, then you could put this in the UserForm's
>> CommandButton's Click event...
>>
>> Worksheets("Sheet1").CommandButton1.Enabled = False
>>
>> Change the worksheet reference and name of the button on the worksheet to
>> match your actual conditions.
>>
>> Rick
>>
>>
>> "ranswrt" <(E-Mail Removed)> wrote in message
>> news:FDA30679-6F92-42EA-B3B8-(E-Mail Removed)...
>> > Is there a way to set a button on a worksheet to enable = false like
>> > with
>> > a
>> > commandbutton on a userform? Will the text lighten to show that it is
>> > disabled?
>>
>>
|