Okay, folks, I am sick of this problem and I need help solving it.
I have a workbook that is shared throughout my workplace. It has a userform (one of many) that has two TreeView controls. These TreeView controls are vital to the process of this workbook. For some reason that I cannot fathom, these two TreeView controls will occasionally delete themselves after other users have opened and used the workbook. And I don't mean that they have shrunk to miniscule sizes so you can't see them, or that they have gone invisible. I mean they're GONE. They are gone when I open the userform in VBA. I don't know why this happens. There is no way a user is going into VBA deliberately and deleting them, because no one in my plant even knows what VBA is, let alone how to find a userform and delete a TreeView from it. These people don't even know how to insert a table!
I am fed up with trying to figure out why this is happening; all internet searches regarding the problem have been useless. Right now I've added code to the Userform Initialize event that checks for the TreeViews' existence, and gives a warning message for the user to contact me if it can't find them, then closes the userform. I did this to keep the code from crashing, but it's obviously not fixing the problem, only telling the user to warn me if the problem has occurred to I can go in and re-insert the TreeViews for the nine hundredth time in a week.
SO. Since I have not come up with a way to prevent the TreeViews from deleting themselves after two straight weeks of searching, I have decided to add the stupid things at runtime and add event handling to them at that point. I mean, what else am I supposed to do? Unless one of you folks can explain to me why this is happening so I can keep them from deleting themselves, I don't have much of a choice.
I know how to add a TreeView at runtime. What I don't know how to do is add event handling to it at runtime. Would someone please explain to me how to do this? Or explain to me why they're deleting themselves in the first place???
Bookmarks