GetObject. need Help

GetObject. need Help

Anonymous
Not applicable
740 Views
3 Replies
Message 1 of 4

GetObject. need Help

Anonymous
Not applicable
Try this again. CreateObject!!
Need help from VB Guru. I am trying to create the Inventor.Application object. I get an error that says
"ActiveX component can't create object" I have the reference set to the Autodesk Inventor library. Here is the test sample code that fails:
Dim oApp As Inventor.Application
On Error Resume Next
Set oApp = GetObject(, "Inventor.Application")
   If Err Then
        retval = MsgBox("Inventor Must be Running. Would You Like to Start Inventor?", vbQuestion + vbYesNo, "Start Inventor")
        If retval = 6 Then
            Set oApp = Nothing
            Set oApp = CreateObject("Inventor.Application")
            If Err Then
                End
            End If
        Else
            End
        End If
    End If

The GetObject works if Inventor is running. Can't figure out why CreateObject fails.

Thanks for any help.
Ray C.

0 Likes
741 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
After Create add
oApp.Visible = True

PS Bet if you look in Task Manager you have a instance or two of Inventor running now.
8^)

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"srayc" wrote in message news:f18140d.-1@WebX.maYIadrTaRb...
> Try this again. CreateObject!!
> Need help from VB Guru. I am trying to create the Inventor.Application object. I get an
error that says
> "ActiveX component can't create object" I have the reference set to the Autodesk
Inventor library. Here is the
>
0 Likes
Message 3 of 4

Anonymous
Not applicable
Forgot to mention, you also need to put a err.clear before the Create object. The error
you are seeing is the one that was thrown from the GetObject Function.

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program
0 Likes
Message 4 of 4

Anonymous
Not applicable
Thanks Kent, I knew it had to be something silly I was doing or not doing. Works great now.
Thanks again

Ray C.
0 Likes