LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default passing objects

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Objects from Excel VBA collection to a VB6 DLL Dan[_50_] Excel Programming 6 February 15th 06 10:34 PM
Passing objects by value instead of by reference aspenbordr Excel Programming 7 August 4th 05 12:13 PM
Passing, Declaring, and Assigning Objects tfrank Excel Programming 0 November 1st 04 06:45 PM
Passing Excel Objects As Parameters Jake Marx[_3_] Excel Programming 0 September 17th 04 04:25 PM
Passing Excel Objects As Parameters MDW Excel Programming 0 September 17th 04 04:17 PM


All times are GMT +1. The time now is 12:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"