PDA

View Full Version : [SOLVED:] Remove Option Buttons from UserForm frame



garynewport
06-07-2016, 03:00 AM
I have a tab system with one tab having a frame. I have code that then populates this frame with option buttons dependant upon the data provided by the user.

I need to clear this frame each time but there are some objects where I need to simply update the contents (a textbox where I simply need to change the caption) but I need to delete all the option buttons.

Through some exploration I began to develop a solution but it does not work:



Dim obt As Object

For Each obt In frm_tasks.Object
If obt.OLEFormat.ProgID = "Forms.OptionButton.1" Then
obt.Delete
End If
Next


frm_tasks is the name of the frame object; not the userform (which has the name feedback_form).

Any help gratefully received.

garynewport
06-07-2016, 03:49 AM
Ignore this!

I decided to create a collection, add each created item to the collection and then simply empty the collection each time; solved!