Just as the question says. I would like to be able to make an array of strings in some VBA code, in this code I would like to make them a certain length. Then how would I pass them into a C++ DLL, in the DLL I would like to store a string in each element and make these elements accessible from the VBA afterwords. I have already done this for a single string, and for a double array as follows.
Dim myStr As String * sizeConst
Dim dataArray() As Double
ReDim dataArray(0 To (arrayLength - 1)) As Double
Then passing them to a DLL from within the VBA.
Public Declare Function myFunc _
Lib "PathToDLL.dll" _
(myStr As String, ByVal sizeConst As Integer, dataArray As Double, ByVal arrayLength As Long) As Long
Then in the DLL I can step through each element in the double array. However I don't know how to do this for a string array. I am unsure about the actual memory size of the strings I would be passing in from the VBA would they be of size sizeConst + 1? I need to know this to know how much I should increment to get to the next string element. Can someone show me how to declare a string array in VBA with a constant length for each element. Then how to pass that array to the DLL and how to increment to the next element in the string array in the DLL.
Note that your dll expects as an input **myStr As String**, not an array of strings, because of function declaration. The trick is the skill to ask a question!arr(lbound(arr)). Then the called site will have access to the entire array.