Code Red > VB(A)

Vb6 and Set acadApp = GetObject(, "AutoCAD.Application")

<< < (2/2)

n.yuan:
Since you run stand-alone EXE to automate AutoCAD as out-process instance, it should not matter that your app is 32-bit EXE app and AutoCAD (2016) is 64-bit app. However, the code you show is used in the VB6 app as is, it would ONLY work when AutoCAD (or BricsCAD) has already been running (i.e. an running instance of AcadApplication instance must exist) in the same computer. If not, your code would raise exception at this line

acadApp.Visible = True

and crash your EXE app.

Lupo76:
The code that I put in the first message is correct.
I did some tests on other PCs and working properly.

However, if in the PC, are installed AutoCAD and BricsCAD the code requests must specify the AutoCAD version.
Eg.


--- Code: ---Set acadApp = GetObject(, "AutoCAD.Application.20.1")

--- End code ---

PS. No need to install VBA!

zzyong00:
try:run as administrator

gps77:
Hello All,

These are the links that finally helped me solve the problem. Make sure to set the CLSID and the AutoCAD.Application.21 (the number) to the appropriate AutoCAD version (this one is for Autocad 2017). Look for it in the registry. It even works with visual basic 5 and 64bit AutoCAD 2017 on Windows 10.

https://stackoverflow.com/questions/40656440/vb6-program-interacting-with-autocad-is-not-longer-able-to-create-or-bind-to-t
https://stackoverflow.com/questions/9125424/late-binding-run-time-error-in-vb6-when-creating-an-object-from-a-net-assembly


--- Code: ---
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AutoCAD.Application.21]
@="AutoCAD Application 21"

[HKEY_CLASSES_ROOT\AutoCAD.Application.21\CLSID]
@="{0D327DA6-B4DF-4842-B833-2CFF84F0948F}"

[HKEY_CLASSES_ROOT\AutoCAD.Application]
@="AutoCAD Application"

[HKEY_CLASSES_ROOT\AutoCAD.Application\CLSID]
@="{0D327DA6-B4DF-4842-B833-2CFF84F0948F}"

[HKEY_CLASSES_ROOT\AutoCAD.Application\CurVer]
@="AutoCAD.Application.21"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoCAD.Application.21]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoCAD.Application.21\CLSID]
@="{0D327DA6-B4DF-4842-B833-2CFF84F0948F}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoCAD.Application]
@="AutoCAD Application"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoCAD.Application\CLSID]
@="{0D327DA6-B4DF-4842-B833-2CFF84F0948F}"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoCAD.Application\CurVer]
@="AutoCAD.Application.21"


--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version