Isaac Moore
Isaac Moore

Reputation: 250

UserForm object persists even after deletion

I have several "phantom" objects in my UserForm that I am designing in VBA (for Excel). They were deleted in the interface builder portion of the form, and there are no remaining references to them in the actual module (at least, in the portion of the module that the IDE will display to me). However, these objects still exist. I cannot re-use their names, and they are visible as members of the form in the Object Browser (see EmployeeFormatFrame and Label1):

Object Browser

Cannot re-use name:

Ambiguous Name

I could really use some help figuring this out. The only thing I could find when researching this problem is this, but it refers to an Access database and therefore isn't of much help. This is a very similar problem to one that I often experienced when working in Borland's C++ Builder, which was always resolved by deleting leftover references to the object in the code. However, I can't find any here (or the IDE won't show them to me).

Upvotes: 1

Views: 296

Answers (1)

cyboashu
cyboashu

Reputation: 10433

VBA is an interpreted language. In VBE the moment you press enter your code statement is converted in P-Code and saved in the application (e.g Excel).

So if you are stuck with phantom objects, the best and most efficient way is to create a new Workbook and transfer all the code and objects to it. Exactly what barrowc suggested in the comment above.

Don't waste your time looking for a solution to fix the existing workbook. Unless you can write a P-code cleaner, creating a new workbook is the quickest fix.

Upvotes: 1

Related Questions