+ Reply to Thread
Results 1 to 5 of 5

Closed Excel but Vba project remained

Hybrid View

  1. #1
    John B
    Guest

    Closed Excel but Vba project remained

    I have a sub that opens several workbooks (with macros embedded).
    at the end of the sub I have

    workbooks("book1.xls").close true ' to close all but 1 workbook

    the workbooks are closed but if I open vba window, I can still see the vba
    projects.

    if I do debug.print workbooks(2).name I get out of range error --> which i
    assume the object no longer exists ...

    how can i truely close workbooks?

    application.quit?

    I want to close all but 1 workbook.

  2. #2
    Shetty
    Guest

    Re: Closed Excel but Vba project remained

    I am also facing the same problem. When I close the workbook by
    File>>>close (not by VBA), workbook closes but the VBA project explorer
    still shows the same. VBA also opens the project contained in closed
    workbook if I double click on it in VBA. I hope to solve the proble
    with the help of experts here.
    Regards,

    John B wrote:
    > I have a sub that opens several workbooks (with macros embedded).
    > at the end of the sub I have
    >
    > workbooks("book1.xls").close true ' to close all but 1 workbook
    >
    > the workbooks are closed but if I open vba window, I can still see the vba
    > projects.
    >
    > if I do debug.print workbooks(2).name I get out of range error --> which i
    > assume the object no longer exists ...
    >
    > how can i truely close workbooks?
    >
    > application.quit?
    >
    > I want to close all but 1 workbook.



  3. #3
    okaizawa
    Guest

    Re: Closed Excel but Vba project remained

    Hi,
    keeping reference to a workbook's object causes this problem.
    check unreleased object.

    Representation:

    'put the following code in a new module and run.

    Public wb As Object

    Sub Test()
    Set wb = Workbooks.Add
    wb.Close False
    End Sub

    If you use Outlook Express and you have a mail envelope in that workbook
    and the envelope is hidden, show the envelope and close the workbook.
    Outlook Express keeps reference to a hidden mail envelope in a workbook.
    I think it is a bug.

    see also
    PRB: Password Prompt for VBA Project Appears After Excel Quits
    http://support.microsoft.com/default...b;en-us;280454

    --
    HTH,
    okaizawa

    Shetty wrote:
    > I am also facing the same problem. When I close the workbook by
    > File>>>close (not by VBA), workbook closes but the VBA project explorer
    > still shows the same. VBA also opens the project contained in closed
    > workbook if I double click on it in VBA. I hope to solve the proble
    > with the help of experts here.
    > Regards,
    >
    > John B wrote:
    >
    >>I have a sub that opens several workbooks (with macros embedded).
    >>at the end of the sub I have
    >>
    >>workbooks("book1.xls").close true ' to close all but 1 workbook
    >>
    >>the workbooks are closed but if I open vba window, I can still see the vba
    >>projects.
    >>
    >>if I do debug.print workbooks(2).name I get out of range error --> which i
    >>assume the object no longer exists ...
    >>
    >>how can i truely close workbooks?
    >>
    >>application.quit?
    >>
    >>I want to close all but 1 workbook.

    >
    >


  4. #4
    John B
    Guest

    Re: Closed Excel but Vba project remained

    As long as it doesnt hog the memory and cause performance issues in
    subsequent runs, then I am pretty much ok with these ghost vba projects
    hanging around.

    I use excel xp at work but when i tested this at home (excel2003):


    Sub test()

    Dim wbk As Workbook


    Workbooks.Open Filename:="book2.xls"
    Workbooks("book2.xls").Close


    End Sub


    Sub test2()

    Dim wbk As Workbook

    Set wbk = Workbooks.Open(Filename:="book2.xls")
    wbk.Close
    Set wbk = Nothing

    End Sub

    no ghost project remained for book2 ...

  5. #5
    Dave Peterson
    Guest

    Re: Closed Excel but Vba project remained

    I've seen a few posts that blame Google's Desktop Search utility. But I had the
    problem before I used that search utility.

    But in my case, it just seemed like an irritant. Those ghost projects never
    caused me any problems.

    I just ignore them.

    But if you want, you can close excel and reopen.

    John B wrote:
    >
    > I have a sub that opens several workbooks (with macros embedded).
    > at the end of the sub I have
    >
    > workbooks("book1.xls").close true ' to close all but 1 workbook
    >
    > the workbooks are closed but if I open vba window, I can still see the vba
    > projects.
    >
    > if I do debug.print workbooks(2).name I get out of range error --> which i
    > assume the object no longer exists ...
    >
    > how can i truely close workbooks?
    >
    > application.quit?
    >
    > I want to close all but 1 workbook.


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1