It does seem odd that it works so differently between applications. I've no idea why it is so.

Well it's hard to suggest anything really because all you've told us is that you want to use some really weird method of automating Access.

If you still want to do it that way you could write to a temp table or log file rather than passing the string direct.

If you don't have to use C++, you could link the database containing your code into another Access db as an add-in. This seems to be the closest to what you're asking for.

Depends what your code does really. If it's just database manipulation stuff that you don't want to duplicate between applications, write a dll and reference it.