Mcad Application Get/CreateObject problem with MDT5/MDT6 on same machine

Mcad Application Get/CreateObject problem with MDT5/MDT6 on same machine

Anonymous
Not applicable
274 Views
2 Replies
Message 1 of 3

Mcad Application Get/CreateObject problem with MDT5/MDT6 on same machine

Anonymous
Not applicable
use the following VB code to set the ACADAPP and MCADAPP variables to the
respective applications via late binding.
This code works fine for MDT5 and MDT6, but when both are installed the last
line bombs out with an error: "Problem in loading application." This also
occurs through VBA. IT works fine when I have just MDT5 or just MDT6 on a
machine. How can I fix this problem?? In the registry, there is a
Mcad.Application and an Mcad.Application.2 entry for classes. We are in the
process of converting to MDT6 and will be leaving MDT5 on the systems, so
this needs to work with both versions.


Dim acadApp as Object
Dim mcadApp as Object

On Error Resume Next
Set acadApp = GetObject(, "Autocad.Application")
If Err = 429 Then 'if Acad Application is not open...
Set acadApp = CreateObject("AutoCAD.Application")
acadApp.Visible = True
acadApp.WindowState = acMax
DoEvents
End If

Set mcadApp = acadApp.GetInterfaceObject("Mcad.Application")

Thanks for your help,

Jody Whitfill
0 Likes
275 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Look for and run mcadautoreg.exe and symbbautoreg.exe in the MDT6 dir and see if
that helps. I also had one case where I simply had to open the references dialog,
unreference the library's, close the dialog, open it and rereference them. Odd
deal.

--
Kent Keller
http://kwikmcad.topcities.com/

"Jody Whitfill" wrote in message
news:05016FE0A2E38C1A0AC2820D937D26F7@in.WebX.maYIadrTaRb...
> use the following VB code to set the ACADAPP and MCADAPP variables to the
> respective applications via late binding.
> This code works fine for MDT5 and MDT6, but when both are installed the last
> line bombs out with an error: "Problem in loading application." This also
> occurs through VBA. IT works fine when I have just MDT5 or just MDT6 on a
> machine. How can I fix this problem?? In the registry, there is a
> Mcad.Application and an Mcad.Application.2 entry for classes. We are in the
> process of converting to MDT6 and will be leaving MDT5 on the systems, so
> this needs to work with both versions.
>
>
> Dim acadApp as Object
> Dim mcadApp as Object
>
> On Error Resume Next
> Set acadApp = GetObject(, "Autocad.Application")
> If Err = 429 Then 'if Acad Application is not open...
> Set acadApp = CreateObject("AutoCAD.Application")
> acadApp.Visible = True
> acadApp.WindowState = acMax
> DoEvents
> End If
>
> Set mcadApp = acadApp.GetInterfaceObject("Mcad.Application")
>
> Thanks for your help,
>
> Jody Whitfill
>
>
>
0 Likes
Message 3 of 3

Anonymous
Not applicable
This is the same problem that occurs when running AutoCAD R14 and 2000 on
the same machine.

Uou may need to reference the exact version you wish to call.

AutoCAD Application Reference:

If you are using AutoCAD R14 and AutoCAD 2000 through VB to Create the
object you must reference them correctly. You must reference them as
AutoCAD.Application.14 or AutoCAD.Application.15 and not just
AutoCAD.Application, (will only work for current version). If your app
using GetObject("AutoCAD.Application") it will find it running no matter
what version it is. You will need to reference the
GetObject("AutoCAD.Application.14") with the version at the end of it.

Located under the HKEY_CLASSES_ROOT in the registry.
AutoCAD.Application.15 - AutoCAD 2000, 2000i or 2002
AutoCAD.Application.14 - AutoCAD R14

This information is stored in the registry. I am going to guess that MCAD
is reference in the same fashion. Start up REGEDIT and look under the
HKEY_CLASSES_ROOT\ for the Mcad.Application object. You might find that is
is reference as Mcad.Application.5 or something like.

Hope this helps.

Thanks,
Lee Ambrosius
HyperPics, http://www.hyperpics.com


> "Jody Whitfill" wrote in message
> news:05016FE0A2E38C1A0AC2820D937D26F7@in.WebX.maYIadrTaRb...
> > use the following VB code to set the ACADAPP and MCADAPP variables to
the
> > respective applications via late binding.
> > This code works fine for MDT5 and MDT6, but when both are installed the
last
> > line bombs out with an error: "Problem in loading application." This
also
> > occurs through VBA. IT works fine when I have just MDT5 or just MDT6 on
a
> > machine. How can I fix this problem?? In the registry, there is a
> > Mcad.Application and an Mcad.Application.2 entry for classes. We are in
the
> > process of converting to MDT6 and will be leaving MDT5 on the systems,
so
> > this needs to work with both versions.
> >
> >
> > Dim acadApp as Object
> > Dim mcadApp as Object
> >
> > On Error Resume Next
> > Set acadApp = GetObject(, "Autocad.Application")
> > If Err = 429 Then 'if Acad Application is not open...
> > Set acadApp = CreateObject("AutoCAD.Application")
> > acadApp.Visible = True
> > acadApp.WindowState = acMax
> > DoEvents
> > End If
> >
> > Set mcadApp = acadApp.GetInterfaceObject("Mcad.Application")
> >
> > Thanks for your help,
> >
> > Jody Whitfill
> >
> >
> >
>
>
0 Likes