Type mismatch: array or user-defined type expected

N

Naftas

Hi Everyone,

can you help with next problem. Here is variable declaration in sub rutine:

Sub PVT_OIL_PB(ByVal TPB As Double, ByVal GAMAGPB As Double, ByVal GAMAOPB
As Double, ByVal PSPB As Double, _
ByVal GORPB As Double, ByRef CAPB() As Double, ByRef APB() As Double)

Here is call statment for Sub PVT_OIL_PB :

Call PVT_OIL_PB(t, GAMAG, GAMAO, PS, GOR, CA(), a())

After calling rutine i have recived next error message:

"Type mismatch: array or user-defined type expected"

Where is my mistake?

Best regards,
Naftas
 
J

John Bundy

Well in this line:
Call PVT_OIL_PB(t, GAMAG, GAMAO, PS, GOR, CA(), a())
the last 2 elements you are passing in are arrays.
But the sub is expecting 7 doubles:
Sub PVT_OIL_PB(ByVal TPB As Double, ByVal GAMAGPB As Double, ByVal GAMAOPB
As Double, ByVal PSPB As Double, _
ByVal GORPB As Double, ByRef CAPB() As Double, ByRef APB() As Double)

You need to change your sub to accept the array, or change how your calling
it to pass in an index within the array which is probably what you are trying
to do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top