|
-
Jul 2nd, 2006, 04:26 PM
#14
Re: Search not helping with Orphaned Excel in task Mngr
Got the PM Si 
Ok, after readng the thread I have a couple of questions/suggestions.
First, since you using a blank new workbook, do you have any personal macros that execute when Excel opens? Second, the posted code examples are all valid and should work. Are you only using the posted code and nothing additional? this is code in a VB 6 Project and not behind Excel's VBA IDE?
In your first post, second code examle, if you click command1 and then 2 it works correctly but if you click command1, command 3, command4 and then command2 will it work ok?
Perhaps placing some Debug.Print statements in command 3 and command4 to print to the immediate window with the number of workbooks open and / or sheets in the book(s).
Use the early binding for the testing to make sure you working with the desired version. Once we get it working with one we can test the other.
VB Code:
'Add a reference to MS Excel 10.0 Object Library
Dim oXLApp As Excel.Application
Dim oXLBook As Excel.Workbook
Private Sub Command1_Click()
Set oXLApp = New Excel.Application
oXLApp.Visible = True
End Sub
Private Sub Command2_Click()
Debug.Print "#2 - oXLApp.WorkBooks.Count Before: " & oXLApp.WorkBooks.Count
'oXLApp.Visible = False 'No need to complicate things until its resolved
oXLApp.Quit
Set oXLApp = Nothing
End Sub
Private Sub Command3_Click()
Debug.Print "#3 - oXLApp.WorkBooks.Count Before: " & oXLApp.WorkBooks.Count
Set oXLBook = oXLApp.Workbooks.Add
Debug.Print "#3 - oXLApp.WorkBooks.Count After: " & oXLApp.WorkBooks.Count
End Sub
Private Sub Command4_Click()
Debug.Print "#4 - oXLApp.WorkBooks.Count Before: " & oXLApp.WorkBooks.Count
oXLBook.Close
Set oXLBook = Nothing
Debug.Print "#4 - oXLApp.WorkBooks.Count After: " & oXLApp.WorkBooks.Count
End Sub
Press Alt+G in the VB 6 IDE to open the Immediate window.
I was just taking a break from painting a bedroom so I may not be back for a while (unless its just too hot to do more).
Last edited by RobDog888; Jul 2nd, 2006 at 04:30 PM.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|