View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
xavi garriga xavi garriga is offline
external usenet poster
 
Posts: 31
Default function with matrix

Dears;

I have a Nightmare with a macro!! I don' know where is the mistake...the
program is a little bit big, so I'll try to do a resume of the code.

First of all i've created a newtype of variable called NewType (I'm not so
much original...):

Here you are the type:

Type NewType
Peca As String
ri As Integer
pi As Integer
qi As Integer
End Type

Inside a macro I call a function like this:

seq = pas_2(C, T_Treballs())
Where C is an integer and T_Treballs() is NewType

The function is declared:
Public Function pas_2(carrega As Integer, vector() As NewType) As NewType

There is a moment inside the function where there is this code:
y = 1
ReDim Preserve pas_2(y)

and a message like this appear:

"Compilation mistake
The program was waiting for a matrix" (or something like this, I work with a
spanish version and I've translated the message)

Why pas_2(y) is not a matrix inside the function??

Thanks a lot!
--
atrep