Syntax error with arrays

T

The Professor

I am trying to compile code that I have had working for over 10 years in
excel for windows. It is in Visual Basic and is really annoying that it
wont work in Mac.

Function someFunction() as string()
End Function


Now the error I get is simply ³Expected: end of statement²

For some reason Excel for Mac doesn¹t like me declaring a function that
returns an array of any type. I am actually using a function to return an
array of custom Type.

The following DOES work:

Function someFunction2() as String
End Function

Any ideas??? Any clues out there?
 
J

JE McGimpsey

The Professor said:
I am trying to compile code that I have had working for over 10 years in
excel for windows. It is in Visual Basic and is really annoying that it
wont work in Mac.

Function someFunction() as string()
End Function


Now the error I get is simply ³Expected: end of statement²

Hmm... I suspect you must have modified your code in WinXL within the
last 6 years.

IIRC, declaring functions which returned arrays was introduced in
VBA6.0, which was introduced in WinOffice2000.

All MacOffice versions, like WinOffice97 are VBA5, so that declaration
won't work.

To return an array in VBA5, you must declare the function as a Variant
instead.
 
R

raj

Hm...you are right. I did modify the code using office2000 (ergo
VBA6). But essentially that's crap. Do you have any clue when
Office4Mac will use/support VBA6.0? Re-writing this code is not
trivial anymore........
 
J

JE McGimpsey

raj said:
Hm...you are right. I did modify the code using office2000 (ergo
VBA6). But essentially that's crap.

??? Not sure why you think it's crap - it's accurate. When you modified
the code in office2000 to include VBA6-only features, became
incompatible with WinOffice97 and MacOffice versions.
Do you have any clue when Office4Mac will use/support VBA6.0?
Re-writing this code is not trivial anymore........

Never. MacBU has announced that MacOffice12 will not support any version
of VBA. Microsoft has also announced that VBA in WinOffice will be
phased out, but only after the next couple of versions.
 
Top