Hay all,
I've been trying to get 2 dynamically created checkboxes next to the caption of a dynamically created frame.
Here is a picture of the closest I've gotten, where the checkboxes are inside the frame.
I've tried making the checkboxes outside the frame but then they are overlapped by the frame and I am unable to bring them forward.
The code to create them:
Is it possible and if so, does anybody know how?
I've been trying to get 2 dynamically created checkboxes next to the caption of a dynamically created frame.
Here is a picture of the closest I've gotten, where the checkboxes are inside the frame.
I've tried making the checkboxes outside the frame but then they are overlapped by the frame and I am unable to bring them forward.
The code to create them:
VBA Code:
'....Code for the rest of the macro
' Create individual frames for each day within the main frame
dayTopPosition = 4
dayLeftPosition = 4
For dayOfWeek = LBound(dayNames) To UBound(dayNames)
' Create a frame for each day
Set dayFrame = page.WS.Controls.Add("Forms.Frame.1", "Frame" & dayNames(dayOfWeek))
dayFrame.Caption = dayNames(dayOfWeek)
dayFrame.Top = dayTopPosition
dayFrame.Left = dayLeftPosition
dayFrame.Width = 340
dayFrame.Height = 120
dayFrame.ScrollBars = fmScrollBarsVertical
dayFrame.ScrollHeight = topPosition
topPosition = 10 ' Reset top position for checkboxes
' Add "Week" checkbox at the top of the day's frame
Set ckbWeek = page.WS.Controls.Add("Forms.CheckBox.1", "ckbWeek_" & dayNames(dayOfWeek))
ckbWeek.Caption = "Weekly sample"
ckbWeek.Top = dayTopPosition
ckbWeek.Left = 50
ckbWeek.Width = 80
ckbWeek.BordersSuppress = True
' Create and assign event handler for ckbWeek
Dim chkHandlerWeek As CkbHandler
Set chkHandlerWeek = New CkbHandler
chkHandlerWeek.Init ckbWeek, dayNames(dayOfWeek)
checkboxHandlers.Add chkHandlerWeek
' Add "Month" checkbox next to the "Week" checkbox
Set ckbMonth = page.WS.Controls.Add("Forms.CheckBox.1", "ckbMonth_" & dayNames(dayOfWeek))
ckbMonth.Caption = "Monthly sample"
ckbMonth.Top = dayTopPosition
ckbMonth.Left = ckbWeek.Left + 80
ckbMonth.Width = 80
' Create and assign event handler for ckbMonth
Dim chkHandlerMonth As CkbHandler
Set chkHandlerMonth = New CkbHandler
chkHandlerMonth.Init ckbMonth, dayNames(dayOfWeek)
checkboxHandlers.Add chkHandlerMonth
'Code for the rest of the macro....
dayTopPosition = dayTopPosition + dayFrame.Height + 5
Next dayOfWeek