Frames on Excel 365 User Form Hiding Added Controls

gedkins

New Member
Joined
Sep 30, 2014
Messages
15
have simple user form in Excel on which I have frame control. At runtime I add radio buttons to the frame. When the form appears the frame is empty. If move the frame the radio buttons appear. Why is the frame hiding the radio buttons? If I delete the frame and then re-add it, the first time I execute the code the buttons appear inside the frame. All subsequent executions and the buttons are hidden again. Any ideas here would be much appreciated.

VBA Code:
Private Sub AddProductLine()
Dim optBtn As control
Dim thisFrame As Frame
Dim c As control

For Each c In Product_Configurator.Controls
    If TypeOf c Is msforms.Frame Then
        Set thisFrame = c
        Exit For
    End If
Next c

Set optBtn = Me.Controls.Add("Forms.OptionButton.1", "GMP", True)
With optBtn
    .Caption = "GMP"
    .Width = 40
    .Top = 50
    .Left = 22
    .GroupName = "ProductLine"
End With
End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
have simple user form in Excel on which I have frame control. At runtime I add radio buttons to the frame. When the form appears the frame is empty. If move the frame the radio buttons appear. Why is the frame hiding the radio buttons? If I delete the frame and then re-add it, the first time I execute the code the buttons appear inside the frame. All subsequent executions and the buttons are hidden again. Any ideas here would be much appreciated.

VBA Code:
Private Sub AddProductLine()
Dim optBtn As control
Dim thisFrame As Frame
Dim c As control

For Each c In Product_Configurator.Controls
    If TypeOf c Is msforms.Frame Then
        Set thisFrame = c
        Exit For
    End If
Next c

Set optBtn = Me.Controls.Add("Forms.OptionButton.1", "GMP", True)
With optBtn
    .Caption = "GMP"
    .Width = 40
    .Top = 50
    .Left = 22
    .GroupName = "ProductLine"
End With
End Sub
I solved the problem
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,272
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top