How are arrays passed to functions?

How are arrays passed to functions?

Anonymous
Not applicable
98 Views
1 Reply
Message 1 of 2

How are arrays passed to functions?

Anonymous
Not applicable
could someone please show an example of both a function call passing an
array, and the receiving function's parameters.
Thanks in advance!
0 Likes
99 Views
1 Reply
Reply (1)
Message 1 of 2

Anonymous
Not applicable
Randy, here is an example of what I think you are talking about. If it
doesn't fit your needs, let me know and we'll try something else. This
example actually demos returning an object from a function as well. Thanks!

Public Function DrawALine(StartPoint As Variant, EndPoint As Variant) As
AcadLine
Dim objAcadLine As AcadLine
Set objAcadLine = ThisDrawing.ModelSpace.AddLine(StartPoint, EndPoint)
Set DrawALine = objAcadLine
End Function

Public Sub DoSomething()
Dim objLine As AcadLine
Dim dblStartPoint(2) As Double
Dim dblEndPoint(2) As Double

dblStartPoint(0) = 0: dblStartPoint(1) = 0: dblStartPoint(2) = 0
dblEndPoint(0) = 1: dblEndPoint(1) = 1: dblEndPoint(2) = 0

Set objLine = DrawALine(dblStartPoint, dblEndPoint)

objLine.Color = acBlue
End Sub
--
Joe Sutphin
Author of "AutoCAD 2000 VBA Programmers Reference"
ISBN #1861002564

Checkout Sources - The magazine dedicated to AutoCAD customization
http://vbdesign.hypermart.net/sources/sources.htm

Visit our website http://vbdesign.hypermart.net/sources/sources.htm and find
out how you can reserve your
copy of the book "The Complete AutoCAD R14.01 and 2000 VBA Reference Guide"

****************************************************************************
*************************

Randy wrote in message
news:ef070d9.-1@WebX.SaUCah8kaAW...
> could someone please show an example of both a function call passing an
> array, and the receiving function's parameters.
> Thanks in advance!
>
0 Likes