craig.penny
Well-known Member
- Joined
- May 8, 2009
- Messages
- 656
Hi all,
I managed to get everything working for a run-time created userform but because it's giving me debugging headaches I want to make the form itself at design time but still have everything else added at runtime. Everything was easy to change except inserting code into the form's code module.
The first line of this code is where it stops. Is there a way to insert code at run-time into a form that was created at design-time?
Thanks for any help!
I managed to get everything working for a run-time created userform but because it's giving me debugging headaches I want to make the form itself at design time but still have everything else added at runtime. Everything was easy to change except inserting code into the form's code module.
HTML:
With MDSByYear.CodeModule
Line = .CountOfLines
.InsertLines Line + 1, "Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)"
.InsertLines Line + 2, "Cancel = True"
.InsertLines Line + 4, "End Sub"
.InsertLines Line + 5, "Private Sub DoneButton_Click()"
For loopCount = 1 To mdsSize
For YrLoopCount = minYear To maxYear + 1
.InsertLines Line + 10 * (maxYear - minYear + 5) + YrLoopCount - minYear + 1, _
"BootBoolean(" & loopCount & "," & YrLoopCount & "," & SelCaseCount & ") = me.checkbox" & (loopCount - 1) * (maxYear - minYear + 1 + 1) + (YrLoopCount - minYear + 1) & ".Value"
Next YrLoopCount
Next loopCount
Line = .CountOfLines
.InsertLines Line + 5, "Me.Hide"
.InsertLines Line + 10, "End Sub"
End With
The first line of this code is where it stops. Is there a way to insert code at run-time into a form that was created at design-time?
Thanks for any help!