Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need help to start ACAD2k via VB

9 views
Skip to first unread message

Ng Kok Weng

unread,
Jul 3, 2001, 2:14:10 AM7/3/01
to
I am having problem to start ACAD2K via VB using the codes below
(I obtained the code from one of the samples of Activex known as
facility that comes along with ACAD2K).

The codes are as below :


Public objAcad As Object
Public objDoc As Object

Private Sub StartAutoCAD()
Dim DwgName As String
On Error Resume Next
Set objAcad = GetObject(, "AutoCAD.Application")
If Err Then
Set objAcad = CreateObject("AutoCAD.Application")
Err.Clear
End If

If Right(App.Path, 1) = "\" Then
DwgName = App.Path & "facility.dwg"
Else
DwgName = App.Path & "\facility.dwg"
End If
Set objDoc = objAcad.ActiveDocument

I don't know why it wouldn't start and the worse thing is that there is
no error meesage. When clicked the button launch acad, nothing
happens, no window of ACAD2K came out, no error, nothing happen.
I tried to change createobject or getobject from AutoCAD.Application to
AutoCAD.Application.15. Still nothing happened. I hope there is some one

out there knows what's wrong with my codes. Is it a path problem???


Warmest Regards

Ng Kok Weng

Stephan Koster

unread,
Jul 3, 2001, 7:15:28 AM7/3/01
to
I think you simply have to add

objAcad.Visible = True

Stephan

Ng Kok Weng

unread,
Jul 4, 2001, 2:21:54 AM7/4/01
to
Thanks! I am sorry I forgot to mention I tried that too. But still nothing
happened.
I checked the list systems loaded in my memory but ACAD was not there. I don't

ACAD2K was launched at all. My suspect is that it has something to do with the

path and probably something in the registry. I do hope someone knows the
details of ACAD2K registration, etc. I have tried to launch ACAD2K with
ShellExecute
and Shell (APIs) and it worked. However when I specified a wrong path in those

APIs, similar situation happened .. i.e. nothing happen. However I have no
idea
where to check ACAD2K library path setting and registration.

Stephan Koster

unread,
Jul 4, 2001, 5:44:54 PM7/4/01
to
Your code works for me as expected.

Take a look in the registry:

HKEY_CLASSES_ROOT\AutoCAD.Application\CLSID

and then

HKEY_CLASSES_ROOT\CLSID\[The value from above]\LocalServer32

-> there you should find the path to your acad.exe,
if it is the wrong path, change it; if the path
is right then I think you have to reinstall AutoCAD...

Ng Kok Weng

unread,
Jul 4, 2001, 9:36:30 PM7/4/01
to
Thanks for your prompt reply. I agreed with you because I did try the codes it in
the lab (away from my PC) on ACADR14
and it works but then so far I have not been successful trying it out on ACAD2K. In
fact as you mentioned, I did reinstall several times and it's still the same. The
last time I reinstalled, I search the registry and remove any "ACAD" and "AutoCAD"
related subject in the registry but still the same problem. My ACAD2K is upgraded
from ACADR14 so I suspected probably some leftovers that causes confusions to my PC.
I did check my registry and I found out that there are
2 AutoCAD.Application. The details are as below :

HKEY_CLASSES_ROOT\AutoCAD.Application and HKEY_CLASSES_ROOT\AutoCAD.Application.15
For HKEY_CLASSES_ROOT\AutoCAD.Application, there are 2 folders CLSID and CurVer. The
value for
CLSID is {8E75D911-3D21-11d2-85C4-080009A0C626}. While the CurVer has value of
"AutoCAD.Application.15".
The other HKEY_CLASSES_ROOT\AutoCAD.Application.15 has a single folder under it
which is CLSID and the value is the same, {8E75D911-3D21-11d2-85C4-080009A0C626}.

The HKEY_CLASSES_ROOT\CLSID\[The value from above]\LocalServer32 has the path
"d:\Program Files\AutoCAD Architectural 2\acad.exe /Automation" which is the right
path but is the "/Automation" needed?? Anyhow, there are 2 more
folders under HKEY_CLASSES_ROOT\CLSID\{8E75D911-3D21-11d2-85C4-080009A0C626} which
is Progid folder ( has "AutoCAD.Application.15 " as its value) and
VersionIndependentProgId (has value "AutoCAD.Application").
I was wondering whether this "sometimes" AutoCAD.Application.15 and sometimes
AutoCAD.Application causes any
confusions to PC.

After further checking, there is another HKEY_CLASSES_ROOT\CLSID next to the one
above which is {8E75D913-3D21-11D2-85C4-080009A0C626} which has a lot more folder
under it i.e. AuxUserType, DefaultIcon,
InProcHandler32, Insertable, LocalServer32, MiscStatus, ProgId, Verb and it is used
by AutoCAD.Drawing
(HKEY_CLASSES_ROOT\AutoCAD.Drawing. In fact I have 2 AutoCAD.Drawing, one without
extension.15 and one
AutoCAD.Drawing.15. Is this Registry AutoCAD.Drawing supposed to have the same CSLID
with AutoCAD.Application?

Thank you.


Regards

Ng Kok Weng

Stephan Koster wrote:

> Your code works for me as expected.
>
> Take a look in the registry:
>
> HKEY_CLASSES_ROOT\AutoCAD.Application
>

Stephan Koster

unread,
Jul 5, 2001, 5:58:16 AM7/5/01
to
The settings in your registry looks good for me.

The only thing that is different from my settings:
I have no spaces in my path name.
You can try to eliminate the spaces by using
the short name: in the explorer select
d:\Program Files and look in the properties
for the short name (should be something like
progra~1) and do the same for

d:\Program Files\AutoCAD Architectural 2

and then replace the value in the registry
(should be something like
"D:\progra~1\autoca~1\acad.exe /Automation")

If this doesn't work you can try to get more
help in the vba newsgroup.

Ng Kok Weng

unread,
Jul 5, 2001, 9:22:39 PM7/5/01
to
Thanks again. I have changed that but the problem still the same. I will try to get help
from VBA group. Thanks again.

Cheers

0 new messages