Problems and Solution about Resizable Arrays from MicroStation API through COM

Win7 Esp SP1
MicroStation: various
Visual Basic 6
Excel 2007 VBA


Hello world,

I'm posting this again, because I think it is an important matter. The problem is already in the second part of another thread,
http://communities.bentley.com/products/programming/microstation_programming/f/343173/t/95343.aspx
but the real problem is snowed under other things.

While writing this post, I found in another thread the solution that saves me some 7 days of work! It is given by Yongan Fu, many thanks! and is in this thread:
http://communities.bentley.com/products/programming/microstation_programming/f/343173/t/95393.aspx

Still, it is weird. If you use API functions Element.GetDatabaseLinks(), Element.GetTags(), so I suppose all functions returning a resizable array, and then walk from LBound() to UBound() to access the array members, then they result "Nothing" and if you try to use the member's properties, your program crashes or displays a message like "Error -2147483648 Automation Error, connection to library lost", and may hang. 

That is: if you access the API from an "Outside Process" (VB6, Excel VBA), not from an "Inside Process" (MicroStation VBA). In the past, there was no trouble, that is for sure, but what exactly causes this is not clear to me (Windows 7 ?)

I made a zip already (Test_VBA_DGN_Dblink_problem_v2.zip), so I am attaching it anyway for someone who wants an example.

- my testdgn, jwtst1.dgn
- an Excel file with Excel VBA macro using MicroStation and "C:\test\jwtst1.dgn" (crashes)
- a MicroStation VBA macro, to be run from jwtst1.dgn (my MicroStation version was V8i)


(Some notes on how to run from Excel:
- I doubleclick Test_VBA_DGN.xlsm, then select "Programmer", then doubleclick "Visual Basic",
then "UserForm1", then I press F5, then I press button "Test Dgn".
- If "Programmer" is not visible, I see Excel Help
)


regards, Jan Willem

Test_VBA_DGN_Dblink_problem_v2.zip