Question : VBA for Excel - Calling a function from a dll - hanging - suggestions?

Hi All,

I am trying to call a function from a dll in VB for excel.  When I call the function, it crashes excel.  I'm not sure what I am doing wrong.  I am new to calling functions from dlls.  Any suggestions would be greatly appreaciated.

I have attached my VB code.  

Also, I'll include some exerpts from the documentation of the function in the dll because I think my problem may lie in the fact that I'm not converting or passing my variables properly.

The purpose of the function is to retrieve a single value or array of values given the input parameters.
long CR_VBGetSingleRes(const char* A,
const char* B,
int C,
float* D,
int E,
const char* F,
const char* G)

D = address of an array of 32 bit floating point numbers to be populated with the results
F = must be a Null terminated character string.
G = also must be a null terminated character string (but only when a condition is met that is not met in the data I'm trying to retrieve at the moment.)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
Public Declare Function CR_VBGetSingleRes Lib "DResult" (ByVal A As String, _
    ByVal B As String, _
    ByVal C As Long, _
    ByRef D() As Long, _
    ByVal E As Long, _
    ByVal F As String, _
    ByVal G As String _
) As Long



Function CallCResultsFunction()

Dim A As String
Dim B As String
Dim C As Long
Dim D() As Long
Dim E As Long
Dim F As String
Dim G As String

'set values for variables
A = "C:\doe22\"
B = "C:\DOE-2_Output\SFM-w10-v75-hAC-t1-cCAv-mRB-HV-SFDuctSeal-40pct-12pct - Baseline Design"
C = 3005006
E = 1
F = "2005"

'Now call function and send parameters
Call CR_VBGetSingleRes(A, B, C, D, E, F, G)


Debug.Print D(1)


End Function

Answer : VBA for Excel - Calling a function from a dll - hanging - suggestions?

Adtran to UC560 T1 module should not need a T1 crossover.
Basically, we have 3 choices for T1 drop to a router:
1. Standard straight-through CAT5 patch cable  - most common DTE-DCE
2. T1 crossover as JRSCGI shows above - DTE-DTE (i.e. routers back-back)
3. Rollover cable (usually flat, silver cable with Rj45 ends) - sometimes required from DTE to DCE if wired Rj48X


Random Solutions  
 
programming4us programming4us