Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 777689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:38:49+00:00 2026-05-14T19:38:49+00:00

I’ve read many post looking for my answer, but all are similar to this:

  • 0

I’ve read many post looking for my answer, but all are similar to this:
Reading excel files in vb.net leaves excel process hanging

My problem is that I don’t quit the app…

The idea is this:

If a User has Excel Open, if he has the file I’m interested in open… get that Excel instance and do whatever I want to do…

But I don’t to close his File after I’m done… I want him to keep working on it, the problem is that when he closes Excel… The process keeps running… and running… and running after the user closes Excel with the X button…

this is how I try to do it

This piece is used to know if he has Excel open, and in the For I check for the file name I’m interested in.

    Try
        oApp = GetObject(, "Excel.Application")
        libroAbierto = True
        For Each libro As Microsoft.Office.Interop.Excel.Workbook In oApp.Workbooks
            If libro.Name = EquipoASeccionIdSeccion.Text & ".xlsm" Then
                Exit Try
            End If
        Next
        libroAbierto = False
    Catch ex As Exception
        oApp = New Microsoft.Office.Interop.Excel.Application
    End Try

here would be my code… if he hasn’t Excel open, I create a new instance, open the file and everything else.

My code ends with this:

If Not libroAbierto Then
        libroSeccion.Close(SaveChanges:=True)
        oApp.Quit()
    Else
        oApp.UserControl = True
        libroSeccion.Save()
    End If    
    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(libroOriginal)
    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(libroSeccion)
    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(origen)
    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(copiada)
    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(oApp)
    libroOriginal = Nothing
    libroSeccion = Nothing
    oApp = Nothing
    origen = Nothing
    copiada = Nothing
    nuevosGuardados = True

So you can see that, if I opened the file, I call oApp.Quit() and everything else and the Excel Process ends after a few seconds (maybe 5 aprox.)

BUT if I mean the user to keep the file open (not calling Quit()), Excel process keeps running after the user closes Excel with the X button.

Is there any way to do what I try to do?? Control a open instance of excel and releasing everything so when the user closes it with the X button, the Excel Process dies normally???

Thanks!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T19:38:50+00:00Added an answer on May 14, 2026 at 7:38 pm

    It seems to me it would be better to use CreateObject instead of GetObject(, "Excel.Application") (see http://support.microsoft.com/kb/288902/en and http://technet.microsoft.com/en-us/library/ee176980.aspx). Then call of Quit method before calling of FinalReleaseComObject and assigninh Nothing will be have a clear sense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want to count how many characters a certain string has in PHP, but
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.