PDA

View Full Version : User Form Does Not Recognize Properties



MWE
03-13-2006, 06:38 PM
I have a several user forms in Word's Normal.dot file that have suddenly lost their ability to recognize their own properties. Not the standard or default properties, just any object I add (or have added) from the toolbox. There are a dozen forms; 3 are so afflicted; the rest are fine.

I have never seen anything like this before. Any idea what might be going on here?

Jacob Hilderbrand
03-13-2006, 08:12 PM
Do you mean that you can't add controls, or they just don't work. Do you get an error message? Can you post the file?

fumei
03-13-2006, 11:39 PM
Are you saying the controls are visible but they just don't work. Don't work how? Are you saying some of the events work, but some do not? None of the events work? More details please. And yes, post a file if possible.

MWE
03-14-2006, 06:27 PM
Do you mean that you can't add controls, or they just don't work. Do you get an error message? Can you post the file? I can add controls and they behave during the "building process" as they should. I can modify properties, etc. However, when I refer to them in the code module associated with that userform, the recently added controls do not exist. They are not displayed after "Me." and if I just type in the proper name, I get a compile error at execution.

But it gets more interesting.

If I exit the VBA editor and return, the recently added controls are not "known" to the form. But if I exit Word and restart Word, the controls are now understood or known by the form and I can work with them in code as one would normally expect.

As mentioned initially, this occurs with 3 forms (of a half dozen) that are stored in Normal.Dot. If I move one of the forms to the ActiveDocument, no change in how it behaves. If I create a new form, it behaves as it should. It is just these 3 forms.

The only thing possibily different about these particular forms is that they were copied to the active document, renamed and copied back to Normal.Dot This is a simple way to generate a copy of a userform when you want similar look and feel to several slightly different forms. I have done this lots of time in Excel and never had a problem. I think that this is the first time I have done this in Word. So I tested this possible bug by creating a new form in Normal.Dot, copying it to the active doc, renaming it and copying it back. I then diddled with new/old controls and everything worked fine. So, it is still the same 3 forms that are buggy.

I can rebuild these forms and get on with my life, but it bothers me that I do not know WHY I am having this problem.

Update: it gets worse. I played around with one of the buggy forms and suddenly VBA went nuts and started claiming that "everything" was ambiguous and multiply defined. It was actually pretty funny as I commented out various things and eventually VBA started claiming that spaces were ambiguous and multiply defined. So I trashed the offending forms (exporting them to a isolated directory -- no telling what disease they have and what they might do to other code :) ) and will rebuild them