On 8/12/04 8:39 AM, "Sean Arney" <sean at rulessoftware dot com> wrote:
> Will,
> I guess I wrongly assumed that from something I misread in the O¹Reilly
> book sorry. In any case, the issue I¹m having is trying to pass the
> contents of a 2D array directly to an Excel range (via OLEObject) as in VB
> since the compile error I get says expecting Variant - not allowing
> Variant(). So I loop through the contents of a multi column listbox and
> create an array to hold the values. I want those values in an Excel
> spreadsheet. If I loop through, inserting values, it takes forever about
> a second per record (at 29 columns). Does anyone know a trick or can help
> me transfer the array or list values into Excel faster?
If you're using RB 5.5.3, you can use the OLEParameter class:
Dim excel as new ExcelApplication
Dim a(2, 0) as Variant
Dim param as new OLEParameter
Dim r as ExcelRange
a(0, 0) = 1
a(1, 0) = 2
a(2, 0) = 3
param.Type = OLEParameter.ParamTypeSignedLong
param.Value2D = a
excel.Visible = true
excel.WorkBooks.Add
a = excel.Range("A2", "A4")
r.Value2 = param
Regards,
William Yu
william at realsoftware dot com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|