View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kevin B Kevin B is offline
external usenet poster
 
Posts: 1,316
Default referencing forms controls


You can loop through them as members of the Controls collection

Dim ctl As Control

For Each ctl In Me.Controls

If ctl.Name = "Label2" Then
Me.Label2.ForeColor = vbRed
End If
Next ctl

--
Kevin Backmann


"AlbertYWang" wrote:

I have a series of labels on a form that I want to change the text
color on programatically.
If the label names are like 'label1', 'label2','label3', is there a a
way to loop through them?

Albert Wang