Difficulty with Arrays in Excel's DECLARE statement

M

MichaelDavid

Greetings! I am having difficulty with with Arrays in Excel's DECLARE
statement.

My Excel module VBA code is as follows:

Option Base 0
Option Explicit
Public Declare Sub TestPassVars Lib "C:\ExcelDLLs\TestPassVars.dll" (ByRef
MaxInsInv As Double, ByRef SrCount As Double, ByRef K As Long, ByRef
InsiderInv() As Double, ByRef InsiderJrSr() As String, ByRef LstRowData As
Long)

Sub ChkPassVars()

Dim K As Long
Dim MaxInsInv As Double
Dim SrCount As Double
Dim InsiderInv(0 To 100) As Double
Dim InsiderJrSr(0 To 100) As String
Dim LstRowData As Long

K = 4
MaxInsInv = 123321#
InsiderInv(0) = 12333#
InsiderJrSr(0) = "xc"
LstRowData = 5400
SrCount = 3.5

Call TestPassVars(MaxInsInv, SrCount, K, InsiderInv(), InsiderJrSr(),
LstRowData)

End Sub

MaxInsInv, SrCount, K, and LstRowData (all non-arrays) are being passed
correctly to TestPassVars. The arrays, InsiderInv() and InsiderJrSr() are
not being passed to the TestPassVars subroutine.

The TestPassVars subroutine was written in Emergence Basic, compiled as a
DLL, and is as follows:

export TestPassVars
SUB TestPassVars(MaxInsInv:Double BYREF, SrCount:Double BYREF, K:INT BYREF,
InsiderInv[]:Double BYREF, InsiderJrSr[]:String BYREF, LstRowData:Int BYREF)

' Various Print statements to display the parameters passed to TestPassVars.

ENDSUB

I suspect that I have not correctly declared the parameter list of Excel Sub
TestPassVars. Thank you very much in advance for your assistance and
suggestions.

May you have a most blessed day!

Sincerely,

Michael Fitzpatrick
 

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