Message 1 of 3
VBA leaves an Excel process

Not applicable
02-16-2006
08:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can anyone tell me why I run this code and it
leaves an Excel process running till I close ACAD? And how can I stop this
from happening?
leaves an Excel process running till I close ACAD? And how can I stop this
from happening?
<snip>
Dim excelApp As Object
Dim wbkObj As
Object
Dim shtObj As Object
Dim wbkObj As
Object
Dim shtObj As Object
On Error Resume
Next
Set excelApp = GetObject(,
"Excel.Application")
If Err <> 0
Then
Err.Clear
Set excelApp =
CreateObject("Excel.Application")
If Err <> 0
Then
MsgBox "Could not start Excel",
vbExclamation
End
End If
End If
excelApp.Visible = True
Set
wbkObj = Workbooks.Open(FileName:=strDWGIndex)
If
Workbooks.COUNT = "0" Then
Workbooks.Add
End If
Set wbkObj =
Nothing
Set excelApp = Nothing
Next
Set excelApp = GetObject(,
"Excel.Application")
If Err <> 0
Then
Err.Clear
Set excelApp =
CreateObject("Excel.Application")
If Err <> 0
Then
MsgBox "Could not start Excel",
vbExclamation
End
End If
End If
excelApp.Visible = True
Set
wbkObj = Workbooks.Open(FileName:=strDWGIndex)
If
Workbooks.COUNT = "0" Then
Workbooks.Add
End If
Set wbkObj =
Nothing
Set excelApp = Nothing
End Sub
<snip>
--
Thanks,
David M.
Gardner
Change the DOT to reply