Howdy,
For some reason I am unable to get this ocde to work. I'm trying to programmatically add two optionbuttons to a frame which is also created in the macro. I created a test file and had no trouble adding the button to a frame which was created prior to compiling. I'm guessing the trouble lies in the frame code. here's what I have code wise:
Here is the test code for the frame which begins in the form before compilation. This code works exactly how I what the previous code to work. I'm not seeing the difference. Perhaps someone can point out what I'm apparently blind to.
Note the code below is for only one option button, not both.
Thanks in advance!
For some reason I am unable to get this ocde to work. I'm trying to programmatically add two optionbuttons to a frame which is also created in the macro. I created a test file and had no trouble adding the button to a frame which was created prior to compiling. I'm guessing the trouble lies in the frame code. here's what I have code wise:
Code:
'Adds frame for option buttons
With Summary_Final
Set ppFrame = .Controls.Add("Forms.Frame.1")
With ppFrame
.Left = ppLabel1.Left + ppLabel1.Width
.Top = ppLabel1.Top - 1
.Width = 35
.Height = 14
.Caption = ""
.BorderStyle = 0 'None
.BorderColor = &H8000000F
.ForeColor = &H8000000F
.BackColor = &H8000000F
.SpecialEffect = 0 'Flat
.Visible = True
End With
End With
'Adds option buttons
With ppFrame
Set ppOpBut1 = .Controls.Add("Forms.OptionButton.1")
With ppOpBut1
.Left = ppLabel1.Left + ppLabel1.Width + 5
.Top = ppLabel1.Top
.Width = 12
.Height = 12
.Caption = ""
.Locked = False
End With
End With
Here is the test code for the frame which begins in the form before compilation. This code works exactly how I what the previous code to work. I'm not seeing the difference. Perhaps someone can point out what I'm apparently blind to.
Note the code below is for only one option button, not both.
Code:
Dim q As Object
With Frame1
Set q = .Controls.Add("Forms.optionButton.1")
q.Top = Frame1.Top + 10
End With
Thanks in advance!