joaquinfb
07-17-2012, 05:27 PM
Hola a todos:
Estoy trabajando en la creación de formularios en tiempo de diseño con VBA.
El siguiente código lo realiza
Sub Test()
Dim Frm As Object
Dim Frame As MSForms.Frame
Dim OptionB As MSForms.OptionButton
Set Frm = ThisWorkbook.VBProject.VBComponents.Add(3)
Set Frame = Frm.designer.Controls.Add("Forms.frame.1")
With Frame
.Name = "Frame1"
.Caption = "Frame1"
.Top = 5
.Left = 5
.Width = 75
.Height = 40
End With
Set OptionB = Frm.designer.Controls.Add("Forms.optionbutton.1")
With OptionB
.Name = "OButton1"
.Caption = "Female"
.Top = 15
.Left = 80
.Width = 60
.Height = 16
End With
Set OptionB = Frm.designer.Controls.Add("Forms.optionbutton.1")
With OptionB
.Name = "OButton2"
.Caption = "Male"
.Top = 15
.Left = 140
.Width = 60
.Height = 16
End With
VBA.UserForms.Add(Frm.Name).Show
ThisWorkbook.VBProject.VBComponents.Remove Frm
End Sub
Mi problema consiste en que no se como insertar los optionbutton en el frame.
Agradecería alguna orientación.
Gracias de antemano.
Estoy trabajando en la creación de formularios en tiempo de diseño con VBA.
El siguiente código lo realiza
Sub Test()
Dim Frm As Object
Dim Frame As MSForms.Frame
Dim OptionB As MSForms.OptionButton
Set Frm = ThisWorkbook.VBProject.VBComponents.Add(3)
Set Frame = Frm.designer.Controls.Add("Forms.frame.1")
With Frame
.Name = "Frame1"
.Caption = "Frame1"
.Top = 5
.Left = 5
.Width = 75
.Height = 40
End With
Set OptionB = Frm.designer.Controls.Add("Forms.optionbutton.1")
With OptionB
.Name = "OButton1"
.Caption = "Female"
.Top = 15
.Left = 80
.Width = 60
.Height = 16
End With
Set OptionB = Frm.designer.Controls.Add("Forms.optionbutton.1")
With OptionB
.Name = "OButton2"
.Caption = "Male"
.Top = 15
.Left = 140
.Width = 60
.Height = 16
End With
VBA.UserForms.Add(Frm.Name).Show
ThisWorkbook.VBProject.VBComponents.Remove Frm
End Sub
Mi problema consiste en que no se como insertar los optionbutton en el frame.
Agradecería alguna orientación.
Gracias de antemano.