Jcat
宠辱不惊,闲看庭前花开花落~~
posts - 173,comments - 67,trackbacks - 0
Declaring and Initialization
Option   Explicit
 
Sub  arrayInVBA()
    
Dim  a1( 5 As   String
     Debug.Assert 
LBound (a1)  =   0
     Debug.Assert 
UBound (a1)  =   5
     Debug.Assert 
TypeName (a1)  =   " String() "

    
Dim  a2( 2   To   5 As   Integer
     Debug.Assert 
LBound (a2)  =   2
     Debug.Assert 
UBound (a2)  =   5
     Debug.Assert 
TypeName (a2)  =   " Integer() "

    
Dim  arrayFunction: arrayFunction  =  Array( " aa " " bb " " cc " " dd " " ee " " ff " )
     Debug.Assert 
LBound (arrayFunction)  =   0
     Debug.Assert 
UBound (arrayFunction)  =   5
     Debug.Assert 
TypeName (arrayFunction)  =   " Variant() "

    
' initialize by Array() function
     Dim  i  As   Integer
    
For  i  =   0   To   5
        a1(i) 
=  arrayFunction(i)
    
Next  i
    
    
For  i  =   0   To   5
       Debug.Print a1(i)
    
Next  i
End Sub
posted on 2008-03-28 18:11 Jcat 阅读(352) 评论(0)  编辑  收藏 所属分类: VBA

只有注册用户登录后才能发表评论。


网站导航: