Inventor from inside Access |
Top Previous Next |
Here is what I use:
Dim invApp As Inventor.Application
Public Function GetInventorApp() As Inventor.Application
' This is an essential part beause GetObject could throw an exception On Error GoTo InvMissing
If Not invApp Is Nothing Then Debug.Print "InvApp already ok" Set GetInventorApp = invApp Exit Function End If
'try to get open instance of Excel Application Set invApp = GetObject(, "Inventor.Application") 'tries to retrieve running instance of Inventor
Set GetInventorApp = invApp
Debug.Print "InvApp found ok "
Exit Function
InvMissing: ' We hope that GetObject has thrown an exception only because Inventor is not already running Set invApp = CreateObject("Inventor.Application") If invApp Is Nothing Then Call MsgBox("Failed to Get or Create Inventor Application instance. Exiting.", , "") Else Debug.Print "InvApp created ok " End If
End Function
|
Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)