Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Making array in DLL available in VBA?
Hello,
I try to populate a 2 dims array in VBA with a 2 dims created in DLL(via VB6). Declaring in Vb6 the array as public is rejected. Help please Avi |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Making array in DLL available in VBA?
A bit vague on detail, I gess you are trying to make an array Public in a
class module of your dll. Can't do that in VB or VBA. One of many ways - ' Class1, public class in the dll or simply in VBA for testing Dim mnArr(0 To 5) As Long Public Function PopArray(n As Long) For i = 0 To UBound(mnArr) mnArr(i) = n * i Next End Function Public Function GetArray(theArray() As Long) theArray = mnArr End Function ' normal module in VB or VBA Dim c As Class1 Sub Test() FillArray GetArray ClearUp End Sub Sub FillArray() If c Is Nothing Then Set c = New Class1 c.PopArray 10 End Sub Sub GetArray() Dim anArray() As Long If c Is Nothing Then Exit Sub c.GetArray anArray For i = LBound(anArray) To UBound(anArray) Debug.Print i, anArray(i) Next End Sub Sub ClearUp() Set c = Nothing ' destroy the class (and/or quit the dll) End Sub Regards, Peter T "avi" wrote in message ps.com... Hello, I try to populate a 2 dims array in VBA with a 2 dims created in DLL(via VB6). Declaring in Vb6 the array as public is rejected. Help please Avi |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Making array in DLL available in VBA?
Hello peter,
Thanks again for your help. As it seems quite problematic and difficult to reference everything in VB6, i decided to rewrite all my VBA code in VB6 with only a reference to the active workbook, as it is an add-in. The decision seems very promising for the moment Thanks again Avi |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
making sure a cell in an array is not duplicated | Excel Discussion (Misc queries) | |||
Quickest Way of making an Array | Excel Programming | |||
Making Array Formula, please assist! | Excel Worksheet Functions | |||
Making array from range | Excel Programming | |||
Making progress with array functions, another two questions | Excel Programming |