Question

Am Using Inventor api for customizing inventor documents.Here I use vb.net code for start an instance of the Inventor .my code is

 inventorApp = CreateObject("Inventor.Application", "")
 inventorApp.Visible = True

it is ok and working fine .but when we open the visual studio run as administrator then the createobject having some error.Any one know any other way to start an instance of Inventor?

No correct solution

OTHER TIPS

Try using the marshal method instead.

    Dim m_inventorApp As Inventor.Application
    Try ' Try to use active inventor instance

        Try
            m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
            m_inventorApp.SilentOperation = True
        Catch ' If not active, create a new instance of Inventor
            Dim inventorAppType As Type = System.Type.GetTypeFromProgID("Inventor.Application")
            m_inventorApp = System.Activator.CreateInstance(inventorAppType)
            ' Must set visible explicitly
            m_inventorApp.Visible = True
            m_inventorApp.SilentOperation = True
        End Try
    Catch
        'Cant get or create an instance of inventor.
    End Try
Private Sub Open_Button_Click()

ThisApplication.SilentOperation = True                'Suppresses the resolve links dialog

Dim myPath As String
myPath = FileName.Text                              'Gets the string, FileName, from module 1
Dim Shell As Object
Set Shell = CreateObject("Shell.Application")
Shell.Open (myPath)                                                      'Opens selected file

Resolve_and_Open.Hide                                               'Hides module

CompareStrings

End Sub

This is to open a sad assembly that needs to resolve links. I'm not sure if this will get around that error, but try using this:

ThisApplication.SilentOperation = True

Either that, or creating a shell and then opening it that way instead of directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top