How do I Pass Data to DLLs from Visual Basic for Applications?
Arrays In versions of Microsoft Excel prior to 5.0 arrays were passed to and from DLLs using the XLOPER structure. This structure was quite similar to how arrays were maintained internal to Excel and made quite a bit of sense. When VBA was added to Excel v5.0 a second method of passing array data was introduced. This new method is based upon the OLE 2.0 SafeArray data type. This makes sense when you realize how heavily dependent upon OLE VBA is. The SafeArray data type is allocated using a series of OLE 2.0 functions which all start with SafeArray.