Hi There,
I have been using the code below to add a label to a frame within a form with its attributes determined by cell contents on a worksheet. The code works very well but I would like to use alertantive frame names as opposed to Fra1 such as Fra2, Fra3 or whatever.
When I try replacing the:-
Set lbl1 = Fra1.Controls.Add("Forms.label.1")
with Set lbl1 = "Fra"&inc&".controls.add("forms.label.1")"
where inc=1
the form does not pick up the label - I also tried replacing the quotation marks with chr(34) but that did not seem to help.
any ideas??
Regards
Pete
I have been using the code below to add a label to a frame within a form with its attributes determined by cell contents on a worksheet. The code works very well but I would like to use alertantive frame names as opposed to Fra1 such as Fra2, Fra3 or whatever.
When I try replacing the:-
Set lbl1 = Fra1.Controls.Add("Forms.label.1")
with Set lbl1 = "Fra"&inc&".controls.add("forms.label.1")"
where inc=1
the form does not pick up the label - I also tried replacing the quotation marks with chr(34) but that did not seem to help.
any ideas??
Regards
Pete
Code:
Set lbl1 = Fra1.Controls.Add("Forms.label.1")
With lbl1
.Caption = Sheets("inputs").Cells(3, 5)
.Left = Sheets("inputs").Cells(3, 3)
.Top = Sheets("inputs").Cells(3, 2)
.Width = Sheets("inputs").Cells(inc, 6)
.Height = Sheets("inputs").Cells(inc, 7)
.Font.Bold = True
.Font.Size = 10
.ForeColor = RGB(0, 0, 160)
.Name = "lbl1"
End With