Faster Control Type Checking in "View" Menu's Code
Posted on 2004-04-27
Hi, I'm writing code for standard "View" menu, such as "Copy", "Cut", "Paste" and so on. Before performing these operations, I need to check the type of active control. For example, "Cut", "Copy" and "Paste" actions should not been apply on a checkbox, button, and some other control types. What I'm trying now is as follow:
Dim ctrl as Control
Set ctrl = Screen.ActiveControl
If (TypeOf ctrl Is CheckBox) Or (TypeOf ctrl Is CommandButton) Or (...) Or (...) Then
mnuCopy.Enabled = False
So is there any faster way to check the compatibility between actions (Copy, Paste, ..) with the control type.