ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Passing Strucutres from VBA to DLL and back (https://www.excelbanter.com/excel-programming/336511-passing-strucutres-vba-dll-back.html)

mikeduk

Passing Strucutres from VBA to DLL and back
 
Hi,

I need to pass a matrix type data structure between Excel VBA and an
external DLL (XLL actually).

Because of the bug in Excel, where a call to
Application.Evaluate("MyXLLFunction()") will actually call my proc twice, I
want to be able to declare the external method in VBA and call it, without
using Evaluate.

This is easy enough with simple types, but I want to be able to return a
more complex data type back and forth, one similar to the Excel SDK's Multi
type, where you can return multiple rows of multiple columns.

Does anyone know the best way of doing this?

Thanks

Mike Davies


Peter T

Passing Strucutres from VBA to DLL and back
 
Hi Mike,

I can't answer your question but as it's been around a while perhaps clarify
the following for others to consider -

What's the Excel bug that results in your proc being called twice. Is this a
"known issue" or due different parts of some formula requiring the same
function.

Could you illustrate your complex data type. Though from what you describe
it sounds like a normal Range object.

Regards,
Peter T

"mikeduk" wrote in message
...
Hi,

I need to pass a matrix type data structure between Excel VBA and an
external DLL (XLL actually).

Because of the bug in Excel, where a call to
Application.Evaluate("MyXLLFunction()") will actually call my proc twice,

I
want to be able to declare the external method in VBA and call it, without
using Evaluate.

This is easy enough with simple types, but I want to be able to return a
more complex data type back and forth, one similar to the Excel SDK's

Multi
type, where you can return multiple rows of multiple columns.

Does anyone know the best way of doing this?

Thanks

Mike Davies





All times are GMT +1. The time now is 08:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com