Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a function which returns severals integers ...

Status
Not open for further replies.

Rodie

Programmer
Joined
Jun 27, 2004
Messages
132
Location
FR
Hi, :p

I would to create a function which returns 3 integers. I tried with an array and pointer (I know a function can returns only 1 thing) ... but I didn't succeed ... :(
Thanks to answer me ...

Rody
 
Return a delimited string then split it into an array.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
How are you planning to use this "function"?

It would be much simpler to declare it as a Sub. Then you can have as many arguments (parameters) as you need.

 
In 2000+ versions, functions can return arrays:

[tt]public function myarr() as long()
dim l(2) as long
l(0)=123
l(1)=456
l(2)=789
myarr=l
end function[/tt]

then fetch it with

[tt]dim l() as long
l=myarr
debug.print l(2)[/tt]

Roy-Vidar
 
In the VBA help file take a look at ByRef.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top