Hi all
First time poster so please forgive any toe treading that happens.
The attached sheet shows a snippet of the worksheet I'm using to create a userform on the fly.
The code creates the objects on the form according to the Type in Row 1. If the Type is a listbox, the values are populated using the contents of a named range in row 2. This range is dynamic and will grow every time an Org_List entry is added.
The code also creates a set of events dynamically so I can trap a MyListBox_Change() event for the "Referred From" listbox.
This allows me to populate the Named Range value for "RFCOtoKpoc", "Referred_From_Calling_Org_to_Key_point_of_contact". This works fine, populating the Value with Contacts_Org2 when Org2 is Selected in the "Referred From" list box.
On entry to the "Key point of contact" listbox, I'm able to get the "Contacts_Org2" value from RFCOtoKpoc, as indicated by the "LinksFrom" row. This is then set to the MyListBox.RowSource. All good so far. I've also used direct Range() references in case there's an issue with setting that property.
What I am unable to do is refresh the list in the "Key Point Of Contact" listbox to reflect the contents of the Contacts_Org2 list from that named range.
When in the procedure where I'm attempting the refresh, I can successfully get MyListBox.Name, MyListBox.RowSource, and any number of properties. Trying any listbox method such as MyListBox.Clear, fails with
Run-time error '-2147467259 (80004005)':
Unspecidied error
The code snippet is below.
I'm currently resorting to contemplating re-building the second list box or rebuilding the form entirely. I don't yet know how to remove the second list box and re-building the form completely seems very messy.
Any and all comments appreciated.
Please Login or Register to view this content.
Bookmarks