Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have run into problems with passing objects between procedures. When I
select range in one procedure, save it to local variable in prep_range() and use that variable as an argument for another function VB suddenly converts it to array (if argument type is not required), if object type is required it throws object required error. See code. Why does it try to convert it instead of passing it as an object? many thanks. Function s_setCols() As Object //selects columns Dim a As Object Set a = Application.Union(ActiveSheet.Columns("B:F"), _ ActiveSheet.Columns("H:I"), _ ActiveSheet.Columns("K:N"), _ ActiveSheet.Columns("P:Q")) a.Select Set s_setCols = a End Function Sub s_delCols(rng As Object) // deletes columns Selection.Delete Shift:=xlToLeft End Sub Sub prep_range() //calls procedures Dim rng As Object s_init Set rng = s_setCols // it throws an error 'object required' here, it basically tries to convert object into array s_delCols (rng) End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Passing Objects from Excel VBA collection to a VB6 DLL | Excel Programming | |||
Passing objects by value instead of by reference | Excel Programming | |||
Passing, Declaring, and Assigning Objects | Excel Programming | |||
Passing Excel Objects As Parameters | Excel Programming | |||
Passing Excel Objects As Parameters | Excel Programming |