When the following code is executed, the form that the controls (CheckBoxes 1 to n) are created on fails to "Show" on the sheet. However the form appears in the project window with the correct number CheckBox Controls and if "RUN FORM" is selected the form apears on the sheet and each control works properly when each CheckBox is selected.
If on the other hand, if the code is commented out, the form displays on the sheet with the correct number of CheckBox controls, but no functionality
NOTE: the code shown is in a FOR NEXT loop and is not shown in its entirity.
Any comment would be greatly appreciated!
With TempForm.CodeModule
Line = .CountOfLines
.InsertLines Line + 1, "Sub Checkbox" & i & "_Change()"
.InsertLines Line + 2, " if ActiveChart.SeriesCollection(" & i & ").Format.Line.visible = True then"
.InsertLines Line + 3, ""
.InsertLines Line + 4, "ActiveChart.SeriesCollection(" & i & ").Format.Line.visible= False"
.InsertLines Line + 5, "exit sub"
.InsertLines Line + 6, "else ActiveChart.SeriesCollection(" & i & ").Format.Line.visible= True"
.InsertLines Line + 7, ""
.InsertLines Line + 8, "exit sub"
.InsertLines Line + 9, "end if"
.InsertLines Line + 10, "End Sub"
End With
If on the other hand, if the code is commented out, the form displays on the sheet with the correct number of CheckBox controls, but no functionality
NOTE: the code shown is in a FOR NEXT loop and is not shown in its entirity.
Any comment would be greatly appreciated!
With TempForm.CodeModule
Line = .CountOfLines
.InsertLines Line + 1, "Sub Checkbox" & i & "_Change()"
.InsertLines Line + 2, " if ActiveChart.SeriesCollection(" & i & ").Format.Line.visible = True then"
.InsertLines Line + 3, ""
.InsertLines Line + 4, "ActiveChart.SeriesCollection(" & i & ").Format.Line.visible= False"
.InsertLines Line + 5, "exit sub"
.InsertLines Line + 6, "else ActiveChart.SeriesCollection(" & i & ").Format.Line.visible= True"
.InsertLines Line + 7, ""
.InsertLines Line + 8, "exit sub"
.InsertLines Line + 9, "end if"
.InsertLines Line + 10, "End Sub"
End With