Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Florida, USA
    Posts
    394
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB Cleanup (Office 2000)

    Hi,

    I've always wondered if VB cleans itself up. Let's say I have a form that initially had many command buttons etc. and I decide after a while that I don't need some of those command buttons and I either delete them from the form or replace them with some other command. Does the "command" instructions delete itself from VB as well? or does it remain forever.

    If the deleted instructions stay in the VB, does it then eventually become bloated? Just wondered.

    Thanks!
    Louise

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

    Re: VB Cleanup (Office 2000)

    1) No, VBA doesn't clean itself up - unused code will remain until you remove it.
    2) Unused code contributes to the file size, so it makes sense to scan your code for it from time to time.

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Florida, USA
    Posts
    394
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB Cleanup (Office 2000)

    Hi Hans,

    I had a suspicion that that was true. In the future, would it be a good idea to delete the command in VBA before I delete the button(s)? This way I would be sure of deleting the correct one?

    Thanks Hans,
    Louise

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

    Re: VB Cleanup (Office 2000)

    That's not really necessary, although it would be a good discipline.

    There's a relatively easy way to find out if an event procedure still belongs to an existing control:if you click anywhere in the procedure, the Object dropdown list in the upperleft of the module window will display either the name of the control or the word General. The latter indicated that the procedure doesn't belong to a control any more.

    Note: for "standard" procedures and functions, for example those in a standard module, you'll also see General. That is nothing to worry about, since these procedures and functions are intended to be called from other code, or in an expression.

Posting Permissions

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