表紙へ

全般

3.コントロールの種類を判定する

   

1.単純な例

この例ではControl型(もしくはObject型またはVariant型)の変数oControlの種類を表示する。

 

MsgBox TypeName(oControl)


 

 

2.すべてのコマンドボタンを使用不可にする例

 

Dim oButton As Object

 

For Each oButton In Me.Controls

    If TypeName(oButton) = "CommandButton" Then

        oButton.Enabled = False

    End If

Next oButton