On 7 Sep., ShayneH wrote: > Is there a way to expose an array that is enclosed by a variant? > Basically I have one function that returns a variant type which needs > to be passed to another procedure that requires the parameter to be > typed as a byte array. > > eg: > Function UsuallyReturnsAnArray() As Variant > > the result, after testing to be an array is passed to: > > Sub ConsumesByteArray(ByRef ByteArray() As Byte) > > I need to find a way to coerce the variant that contains a byte array > returned from the first function to a byte array. > Copying each element to a dimensioned array is a possible solution, > but it seems to me there must be a way to reference the array that is > contained inside the variant type.
I don't see your problem: Function getArray() As Variant Dim h(5) As Double getArray = h End Function Sub test() Dim v As Variant v = getArray Dim h() As Double h = v End Sub Regards, Stuart -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel