+ Reply to Thread
Results 1 to 2 of 2

UserForm1 not getting removed using VBA

  1. #1
    Alok
    Guest

    UserForm1 not getting removed using VBA

    Hello friends,

    I need some help.
    I use VBA code to upgrade an existing Excel workbook with new code and
    forms. I do this by removing code modules and User forms using VBA and then
    importing the new code modules and user forms. Things have been working fine
    for the last few months but recently one of the users reported an error -
    which takes place because UserForm1 is not getting removed. The actual error
    takes place when the new UserForm1 is imported by the VBA code.
    I could reproduce the error on my computer as well. The interesting thing is
    that the code does not create an error on the line when UserForm1 is being
    removed. Moreover, when I step through the code I can can see that the
    UserForm1 is still a part of the project even though the VBA code removing it
    has been execuated?!
    Can someone point to what may be happening?

    Thanks

    Alok




  2. #2
    Alok
    Guest

    RE: UserForm1 not getting removed using VBA

    Hi Friends,

    I just created a work-around by trial and error.

    The issue was that one of the forms in the workbook that I was trying to
    upgrade was not being removed inspite of the fact that the code was not
    failing! Hence when the code imported the new version of the form with the
    same name, Excel raised an error saying that the object already exists!

    I just tried different order of deleting. I now delete all the forms first
    and then go on to delete the Modules and Classes and that works. Don't ask me
    why it works but it does.

    Alok

    "Alok" wrote:

    > Hello friends,
    >
    > I need some help.
    > I use VBA code to upgrade an existing Excel workbook with new code and
    > forms. I do this by removing code modules and User forms using VBA and then
    > importing the new code modules and user forms. Things have been working fine
    > for the last few months but recently one of the users reported an error -
    > which takes place because UserForm1 is not getting removed. The actual error
    > takes place when the new UserForm1 is imported by the VBA code.
    > I could reproduce the error on my computer as well. The interesting thing is
    > that the code does not create an error on the line when UserForm1 is being
    > removed. Moreover, when I step through the code I can can see that the
    > UserForm1 is still a part of the project even though the VBA code removing it
    > has been execuated?!
    > Can someone point to what may be happening?
    >
    > Thanks
    >
    > Alok
    >
    >
    >


+ 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