Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do you hide a forms command button
I need to be able to hide and display a command button depending on the
occurrence of certain events. What code can I use to hide and display a command button named "cmdEnterData"? Thank you in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do you hide a forms command button
This is from the Forms toolbar?
Worksheets("Sheet1").Buttons("cmdEnterData").Visib le = True There's another property that you might like, too: .enabled = True/False The button will still be there, but won't do anything if you click it. Paul James wrote: I need to be able to hide and display a command button depending on the occurrence of certain events. What code can I use to hide and display a command button named "cmdEnterData"? Thank you in advance. -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do you hide a forms command button
If ??? True Then cmdEnterData.Visible = True Else cmdEnterData.Visible = False End If Hope this helps... -----Original Message----- I need to be able to hide and display a command button depending on the occurrence of certain events. What code can I use to hide and display a command button named "cmdEnterData"? Thank you in advance. . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do you hide a forms command button
sorry, missed the button is on the worksheet and not a
userform... -----Original Message----- This is from the Forms toolbar? Worksheets("Sheet1").Buttons("cmdEnterData").Visi ble = True There's another property that you might like, too: .enabled = True/False The button will still be there, but won't do anything if you click it. Paul James wrote: I need to be able to hide and display a command button depending on the occurrence of certain events. What code can I use to hide and display a command button named "cmdEnterData"? Thank you in advance. -- Dave Peterson . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
how do you hide a forms command button
I don't think you'll be able to change the color of the button (of the forms
button, you could do it with the controltoolbox toolbar button). But you could change the fontcolor of the characters on the button (or maybe strikethrough the characters). Or you could leave the button active and just assign it to a macro that yells at them. Maybe you could pick and choose from this snippet. Option Explicit Sub testme() Dim myBtn As Button Set myBtn = Worksheets("Sheet1").Buttons("cmdEnterData") With myBtn .Enabled = True .Font.ColorIndex = 12 .Font.Strikethrough = True .OnAction = ThisWorkbook.Name & "!MacroNotAvailable" End With End Sub Sub MacroNotAvailable() MsgBox "Not available" End Sub Paul James wrote: Thanks to Dave and Jim. You're right, Dave, I do like the idea of the Enabled property. Question about that, however. If I used it, I'd like to be able to gray it out, because if you don't, the user has no visual cue that it's been disabled, and it might create confusion when he clicks on it. Whereas if it's grayed out, he's got a visual cue that it's been disabled, presumably for a good reason. Is there a property that enables me to gray out the button when the Enabled property is set to False? Thanks again. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Forms Command Button - Removal | Excel Discussion (Misc queries) | |||
Use of Forms Command-button on Worksheet | Excel Discussion (Misc queries) | |||
Command button on forms | Excel Discussion (Misc queries) | |||
Command Button to Hide/Unhide Rows | Excel Discussion (Misc queries) | |||
Hide command button on worksheet | Excel Programming |