Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _ ByVal wParam As Long, lParam As Any) As Long Sub CButton(frm As Form) For a = 0 to frm.Controls.Count - 1 If TypeOf frm.Controls(a) Is CommandButton Then SendMessage frm.Controls(a).hwnd, &HF4, 0, 0& End If Next a End Sub Private Sub Form_Load() CButton Me End Sub |