That performance hit is unfortunate if it cannot be resolved. Guess it means one has to be judicious in VB's use -- sometimes the performance hit is will be worth it when VB hosted automation yields big benefits, dumping the session when the tasks are complete.
I believe you're getting the VL namespace mismatch error because you're trying to load lisp into a document that is not active.
Said another way, there's no guarantee documents.item(documents.count-1) will return the active document.
Have you tried:
Command: _.VBASTMT
Command: activedocument.sendcommand "(load ""ExeTest"") "
Cheers.
I used this method for over 10 years with VBA 32bit up to 64bit VBA arrival to avoid writing scripts and having a much better error control.
Comando: (setq
(_> *AcadApp* (vlax-get-Acad-Object)
(_> *AcDrwgs* (vla-get-documents *AcadApp*)
(_> *AcAcDwg* (vla-get-ActiveDocument *AcadApp*)
(_> )
#<VLA-OBJECT IAcadDocument 000000002d8363c8> <<< ACTIVE DOCUMENT
Comando: (setq DwgNum (vlax-get-property *AcDrwgs* 'Count))
1
Comando: (vla-item *AcDrwgs* (1- DwgNum))
#<VLA-OBJECT IAcadDocument 000000002d8363c8> <<< ACTIVE DOCUMENT
When I open with:
Comando: (setq NewDoc (vl-catch-all-apply 'vlax-invoke-method (list *AcDrwgs* 'Open "Z:/Temp/Test/Dwg1.dwg" :vlax-false)))
#<VLA-OBJECT IAcadDocument 00000000329439c8>
then it does not give the active document:
Comando: (setq DwgNum (vlax-get-property *AcDrwgs* 'Count))
2
Comando: (vla-item *AcDrwgs* (1- DwgNum))
#<VLA-OBJECT IAcadDocument 00000000329439c8> <<< NEW DOCUMENT
It works in 2013 not in 2017.
%%
(vl-cmdf "_.VBASTMT" "documents.item(documents.count-1).sendcommand \"(load \"\"ExeTest\"\")\n\"")
Run in the NEW DOCUMENT and when closed return back to the ACTIVE DOCUMENT.
With this I can do anything in the new document and in case of error the control returns to the starting document.