OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

MyVariant = Range ("A1:J15000") = Possible ?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Rory
Power User
Power User


Joined: 04 Nov 2004
Posts: 51
Location: Brasilia DF, Brasil

PostPosted: Wed Nov 17, 2004 2:04 am    Post subject: MyVariant = Range ("A1:J15000") = Possible ? Reply with quote

Hi again, due to the sheer volume of data and the masses of formulars in my spreadsheets, in Excel I found things a lot faster to run, by loading all of my data into a variant type variable table ( I have no idea if this is the correct term) in my macros i have many many loops working inside one another and this i found to be much faster than it was working diirectly with cells.

Is this possible in OOo I have been having a play around but to no avail as yet.

Im am still rather new to OOoBasic

Dim MyVariant as Variant

MyVariant = Range("A1:J1500")


any pointers will be much appreciated

thanks in advance again

EDIT***** I think this is called a Variant Array, but I cant find any info on this in OOo*******
EDIT2*** Seems in OOo this is called a DataArray altho still having a little trouble to discover how to use this ?GetDataArray? in VBA I could explore each variable value inside the array via the debuggger will I be able to do this with a Watch and BreakPoint in Ooo??
_________________
Rory

/Cries

OOo 1.1.3/4/5 / 2.0 on Win NT/2000/XP(SP1/2)
Back to top
View user's profile Send private message
Rory
Power User
Power User


Joined: 04 Nov 2004
Posts: 51
Location: Brasilia DF, Brasil

PostPosted: Wed Nov 17, 2004 8:43 am    Post subject: Reply with quote

Ok welll a little progress...

In this thread http://www.oooforum.org/forum/viewtopic.php?t=8005&highlight=variant+array

I found this little sample

Code:
iProb = 0

Set oArea = oSheet.getCellRangeByName("A1:D28595")

nRows = oArea.rows.Count ' Get number of rows
nCols = oArea.Columns.Count ' Get number of columns

' Define the array we will use to store the data. THIS IS THE IMPORTANT BIT
ReDim arrValues(0 To nRows, o To nCols) As Variant

'Get data
arrValues = oArea.getDataArray

' Put data back into cells
oArea.setDataArray (arrValues())  ' This now works!


But alas this does not actually work for me, to the ReDim command ok all is fine, I creat a variant array the same size as the range I want to place into it, but past this I cant put my range of data into my variant array (Data array)

Any ideas ????
_________________
Rory

/Cries

OOo 1.1.3/4/5 / 2.0 on Win NT/2000/XP(SP1/2)
Back to top
View user's profile Send private message
Rory
Power User
Power User


Joined: 04 Nov 2004
Posts: 51
Location: Brasilia DF, Brasil

PostPosted: Fri Nov 19, 2004 4:33 am    Post subject: Reply with quote

Erk,


well things are still not funcionting for me, it appears that ".GetDataArray" does not do what i want it to, it seems to me, and correct me if im wrong, that it in fact creates an array of variables each containing an array of variables.

now I can place my table inside this array of arrays but for me to access one variant is difficult, i need to define the first array to a variable then select the variant do what i want then put it back....

Lost you??? thought so

Code:
teste = dataArray(5)
teste(5) = "alo"
dataArray(5) = teste


this puts the string "alo" into dataarray(5,5) (NOTE *dataarray(5,5)*, will not work sadly)



Am I missing something, can i not creat an array(500,500) and place a range of cells into it?
_________________
Rory

/Cries

OOo 1.1.3/4/5 / 2.0 on Win NT/2000/XP(SP1/2)
Back to top
View user's profile Send private message
DiGro
Super User
Super User


Joined: 02 Jun 2004
Posts: 1415
Location: Hoorn NH, The Netherlands

PostPosted: Fri Nov 19, 2004 8:44 am    Post subject: Reply with quote

Rory,

don't know or this is of some help (if it isn't I'm sorry) but
its from one of our guru's DannyB concerning Array's

http://www.oooforum.org/forum/viewtopic.php?t=5301&highlight=array

DiGro
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group