Results 1 to 21 of 21

Thread: Search not helping with Orphaned Excel in task Mngr

Threaded View

  1. #14
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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:
    1. 'Add a reference to MS Excel 10.0 Object Library
    2. Dim oXLApp As Excel.Application
    3. Dim oXLBook As Excel.Workbook
    4.  
    5. Private Sub Command1_Click()
    6.     Set oXLApp = New Excel.Application
    7.     oXLApp.Visible = True  
    8. End Sub
    9.  
    10. Private Sub Command2_Click()
    11.     Debug.Print "#2 - oXLApp.WorkBooks.Count Before: " & oXLApp.WorkBooks.Count
    12.     'oXLApp.Visible = False 'No need to complicate things until its resolved
    13.     oXLApp.Quit
    14.     Set oXLApp = Nothing
    15. End Sub
    16.  
    17. Private Sub Command3_Click()
    18.     Debug.Print "#3 - oXLApp.WorkBooks.Count Before: " & oXLApp.WorkBooks.Count
    19.     Set oXLBook = oXLApp.Workbooks.Add
    20.     Debug.Print "#3 - oXLApp.WorkBooks.Count After: " & oXLApp.WorkBooks.Count
    21. End Sub
    22.  
    23. Private Sub Command4_Click()
    24.     Debug.Print "#4 - oXLApp.WorkBooks.Count Before: " & oXLApp.WorkBooks.Count
    25.     oXLBook.Close
    26.     Set oXLBook = Nothing
    27.     Debug.Print "#4 - oXLApp.WorkBooks.Count After: " & oXLApp.WorkBooks.Count
    28. 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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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
  •  



Click Here to Expand Forum to Full Width