change caption font color at runtime

G

gkelle

The following code creates checkboxes on a form at runtime
I'm trying to change the font color of the caption

For iColumn = constStartColumn To i_NUMCOLUMNS
Set ctlMyControl = frmEditPartVolume!
frWhereUsed.Controls.Add("Forms.CheckBox.1")
Next iColumn

iLeft = iHorizSpacing
iTop = iVertSpacing

iTotalControls = frmEditPartVolume!frWhereUsed.Controls.Count
iColumn = constStartColumn
For Each ctlMyControl In frmEditPartVolume!frWhereUsed.Controls
ctlMyControl.Caption = Worksheets("Part List").Cells(10,
iColumn)
ctlMyControl.Left = iLeft
ctlMyControl.Height = iCheckBoxHeight
ctlMyControl.Font.Size = 8.25
crashes at this point
ctlMyControl.Font.ColorIndex = 3

ctlMyControl.AutoSize = True
 
T

Tom Ogilvy

ActiveX controls don't have a colorindex property.

ctlMyControl.forecolor = vbRed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top