Message 1 of 1
Inventor doesn't quit

Not applicable
12-13-2004
03:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I run Inventor from VB and want it to quit if my app started the session. On fast PC about 3 GHz the session created doesn't close. In stead it's left in the background and I must use taskmanager to close it. On a AMD Athlon XP 1800+ it works fine.
AIP 9 with SP1 is installed.
This is the code.
Dim objInventor As Inventor.Application
Dim oDrawingDocument As Inventor.Document
Dim objVBAProject As InventorVBAProject
Dim i As Integer
Dim blnStarted As Boolean
On Error Resume Next
Set objInventor = GetObject(, "Inventor.Application")
If Err Then
Set objInventor = CreateObject("Inventor.Application")
objInventor.Visible = True
blnStarted = True
End If
objInventor.SilentOperation = True
On Error GoTo ErrHandler
Set oDrawingDocument = objInventor.Documents.Open("C:\Program\Autodesk\Inventor 9\Samples\Models\VERTICAL PLATE.idw")
For i = 1 To objInventor.VBAProjects.Count
If objInventor.VBAProjects.Item(i).Name = "PDF995_Utskrift" Then
Set objVBAProject = objInventor.VBAProjects.Item(i)
End If
Next i
objVBAProject.InventorVBAComponents(1).InventorVBAMembers(1).Execute
Sleep 1000
oDrawingDocument.Close (True)
Set oDrawingDocument = Nothing
If blnStarted Then
objInventor.Quit
Set objInventor = Nothing
End If
Exit Sub
ErrHandler:
****************
Any one have any clue what is wrong.
thanx
Henrik Jonsson
Inventor Certified Expert
I run Inventor from VB and want it to quit if my app started the session. On fast PC about 3 GHz the session created doesn't close. In stead it's left in the background and I must use taskmanager to close it. On a AMD Athlon XP 1800+ it works fine.
AIP 9 with SP1 is installed.
This is the code.
Dim objInventor As Inventor.Application
Dim oDrawingDocument As Inventor.Document
Dim objVBAProject As InventorVBAProject
Dim i As Integer
Dim blnStarted As Boolean
On Error Resume Next
Set objInventor = GetObject(, "Inventor.Application")
If Err Then
Set objInventor = CreateObject("Inventor.Application")
objInventor.Visible = True
blnStarted = True
End If
objInventor.SilentOperation = True
On Error GoTo ErrHandler
Set oDrawingDocument = objInventor.Documents.Open("C:\Program\Autodesk\Inventor 9\Samples\Models\VERTICAL PLATE.idw")
For i = 1 To objInventor.VBAProjects.Count
If objInventor.VBAProjects.Item(i).Name = "PDF995_Utskrift" Then
Set objVBAProject = objInventor.VBAProjects.Item(i)
End If
Next i
objVBAProject.InventorVBAComponents(1).InventorVBAMembers(1).Execute
Sleep 1000
oDrawingDocument.Close (True)
Set oDrawingDocument = Nothing
If blnStarted Then
objInventor.Quit
Set objInventor = Nothing
End If
Exit Sub
ErrHandler:
****************
Any one have any clue what is wrong.
thanx
Henrik Jonsson
Inventor Certified Expert