Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
| 'Forms - How to enable or disable the Cut, Copy and Paste menus in Edit menu if the text selected or not in a control.
Private Sub mnuEdit_Click()
' The user has clicked on the Edit menu,
' but the menu hasn't dropped down yet.
On Error Resume Next
' Error handling is necessary because we don't know if
' the Active control actually supports these properties.
mnuEditCopy.Enabled = (ActiveControl.SelText <> "")
mnuEditCut.Enabled = (ActiveControl.SelText <> "")
mnuEditClear.Enabled = (ActiveControl.SelText <> "")
End Sub |