Maybe I should put it another way:

Let's say that I have these lines, among others:


   Dim Ctl As Object
   Dim Doc As Object, Sheet As Object

   Dim A As String
   Dim  OBDef As Double ' Or whatever, it doesn't seem to matter in this
case, see further below...

   Doc=ThisComponent
   Sheet=Doc.Sheets.getByName("Blah")

   OBDef=DataSheet.getCellRangeByPosition(4,1,9,3).getDataArray() ' Now
OBDef seems to change to Variant.
   ' By the way, (4,1,9,3) is "E2:J4". Row 2 and 3 in that spreadsheet
contains numbers, row 4 contains text.

   A=OBDef(2,0) ' This doesn't work.

Okay, so far, no good.
When I look at the variables with "Övervakaren" (in Swedish, I don't have a
clue what it might be called in English, but I am talking about the tool
that helps me to see the content of variables while I step through the
macro, the button that allows me to select variables to watch in the Basic
API thing, has a pair of glasses on it and F7 does the same thing), it seems
like OBDef(2)(0) is a Variant/String. What's the difference between
Variant/String and just String?


So my question is really something like this:

How do I, in this meaningless example, make the content of OBDef(2,0), which
is a String variable, originally some text in cell E4 in spreadsheet "Blah",
to be copied to A, which is an ordinary String?

What I would like to achieve is to copy a CellRange to a 2-dimensional
variable. Since some rows contains numbers and other contains text I though
that the type "Variant" could be useable, but obviously not...

No I really have to copy the CellRange cell by cell?

Another solution would perharps be to create a struct (as it's called in C),
but is that possible in OpenOffice.org Basic?

Johnny

Reply via email to