![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Singapore
Posts: 77
|
I met the case that array parameter passing failed.
My testing code is as following: Option Base 1 Sub test(ParamArray array1() As Variant) MsgBox "Ubound(array1) is " & UBound(array1) End Sub Sub main() Dim array2(2) As String array2(1) = "ABC" array2(2) = "BCD" MsgBox "Ubound(array2) is " & UBound(array2()) test(array2) End Sub I run subroutine main. The result is that: Ubound(array2) is 2 Ubound(array1) is 0 Seems that array2 is not passed to subroutine test. Could you help me with it?
__________________
Regards XJ |
|
|
|
|
|
#2 |
|
New Member
Join Date: May 2002
Location: Western Australia
Posts: 25
|
It works this way..
Sub test(array1() As String) MsgBox "Ubound(array1) is " & UBound(array1) End Sub Sub main() Dim array2(2) As String array2(1) = "ABC" array2(2) = "BCD" MsgBox "Ubound(array2) is " & UBound(array2()) Call test(array2) End Sub Regards, Trevor |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Singapore
Posts: 77
|
Thx
__________________
Regards XJ |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|