![]() |
![]() |
|
|||||||
| 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 |
|
New Member
Join Date: Mar 2002
Posts: 49
|
Hi all...
Whats the correct way to pass paramArray?? When I run test() the first msgbox says 3, the second one says 0. Thanks in advance. John eg. my code here Sub CreateReport(xlBook As Workbook, dataReference As String, ParamArray State() As Variant) Dim i xlBook.Worksheets.Add.Name = "MIS" ' Create new sheet msgbox UBOUND(State) For i = 1 To 30 ==> LINE OF INTEREST WriteTable xlBook.Application.Range("A3").Offset(i * 2, 0), "S" & Format(i, "00"), dataReference, State Next i End Sub Sub WriteTable(objStart As Range, SVCode As String, dataReference As String, ParamArray State() As Variant) Dim i, db, str1, str2 MsgBox UBound(State) end sub sub test() CreateReport ActiveSheet.Application, "reference", "f26", "m26", "h26" end sub |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
Quote:
Code:
Sub testParam1(ParamArray state() As Variant)
MsgBox UBound(state)
Call testParam2(state)
End Sub
Sub testParam2(ByVal state As Variant)
MsgBox UBound(state)
End Sub
Sub test()
testParam1 "ab", "cd", "ef"
End Sub
Russell |
|
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Posts: 49
|
Thanks Russell... works perfectly..
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|