Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA Editor Windows Bloat (2000 (9.0.4402 SR-1))

    After editing a VBA module, I tend to close the Visual Basic Editor without closing the module I've been working with first. When I come back to the editor, this module is still open. Over time, these open modules tend to build up resulting in scads of open windows in the editor. Periodically, I take a time out and close them all. This is just a little annoyance -- is there an easy way to have the editor to start up with only the requested module open (or, alternatively, close all open modules before closing the editor window itself)? If not, I guess I'll just have to train myself to close 'em myself.

    Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA Editor Windows Bloat (2000 (9.0.4402 SR-1))

    I don't know of a built-in way to close all open modules, but the following simple function will do that:

    Function CloseAllModules()
    Dim i As Integer
    For i = Modules.Count - 1 To 0 Step -1
    DoCmd.Close acModule, Modules(i).Name
    Next i

    You'd have to copy this to each database, or if you want it to be available in every database, put it into an add-in. Although creating an add-in for just a single function seems overdone, I have attached one to demonstratie that is is possible. If you install it (in Access itself, not in the Visual Basic Editor), it will add an item to the Add-ins menu.
    Attached Files Attached Files

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: VBA Editor Windows Bloat (2000 (9.0.4402 SR-1))

    In 2000 and later, the modules are loaded anyhow, whether they are "open" in the VBE or not. I simply use the project explorer or the Windows menu to find the code container I need and don't worry about closing them, especially since they open right back up again when you open a form or report or call a routine from a module. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Charlotte

  4. #4
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Richland, Washington, USA
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Editor Windows Bloat (2000 (9.0.4402 SR-1))

    Hans,

    Thanks for the tip and the add-in example! Yet another above-and-beyond-the-call response!!!

Posting Permissions

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