Array to Excel?

Len
10-01-2001, 06:08 PM
Can someone show me an easy way to write a VB array to an Excel Spreadsheet? (please)

Thank you.
Len G

Timbo
10-01-2001, 06:41 PM
you can either use a (nested for multi-dimentional arrays) For.. Next loop to drop array elements into Excel cells (can be slow), or you can evaluate the array dimentions then drop the array into the range .Value property:

x = Ubound(arySource)
y= Ubound(arySource,2)

set objExcel = GetObject(strExcelFullPathandName)

objExcel.Sheet(x).Range(cells(1,y),cells(x,y)).Value = arySource

set objExcel = Nothing

I haven't tested this code - the idea is right but you might need references to the Excel obj library to get the Range bit right..


"He who dares my son!.. He who dares.." - Del-Boy Trotter

Len
10-02-2001, 08:49 AM
Thanks! I'll give it a try.
Len

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum