■構文
TypeName(varname)
■説明
変数の型を返します。
第一引数:変数を指定します。
■サンプルコード
TypeName(varname)
■説明
変数の型を返します。
第一引数:変数を指定します。
■サンプルコード
- Option Explicit
- Sub SampleCode()
- Dim Str1 As String
- Debug.Print TypeName(Str1) 'String
- Dim Str2() As String
- Debug.Print TypeName(Str2) 'String() 文字列の配列
- Dim num1 As Integer
- Debug.Print TypeName(num1) 'Integer
- Dim num2 As Long
- Debug.Print TypeName(num2) 'Long
- Dim yymmdd As Date
- Debug.Print TypeName(yymmdd) 'Date
- Dim obj As Object
- Debug.Print TypeName(obj) 'Nothin (Set前)
- Set obj = CreateObject("Scripting.Dictionary")
- Debug.Print TypeName(obj) 'Dictionary (Set後)
- End Sub
0 件のコメント:
コメントを投稿