J
jjfeenix
I have a doc with a series of combo box controls that all need to be
initialized with the same list. This only needs to be done once, when a doc
is started from the template, so I put the initialization code into the
Document_New private sub.
If I call the combo box by it's name, it's fine (ex: cbCategory01). But I
want to initialize all 24 in a loop. I thought I could do this with a loop
that fed the combo box name as a constructed sting variable (cbCategoryName =
"cbCategory" & "01") where "01" is incremented to "02" thru "24". But I get
invalid qualifier errors. I moved the initialization code to a Public sub,
called from the Document_New, but still get the error. (I know that the code
below doesn't contan a loop, because I can't get it to work for just the
first iteration. )
Public Sub InitializeCategory()
Dim cbCategoryName As String
cbCategoryName = "cbCategory" & "01"
cbCategoryName.Clear
cbCategoryName.BackColor = cellWhite
cbCategoryName.ForeColor = cellBlack
End Sub
Any help would be appreciated,
TIA
initialized with the same list. This only needs to be done once, when a doc
is started from the template, so I put the initialization code into the
Document_New private sub.
If I call the combo box by it's name, it's fine (ex: cbCategory01). But I
want to initialize all 24 in a loop. I thought I could do this with a loop
that fed the combo box name as a constructed sting variable (cbCategoryName =
"cbCategory" & "01") where "01" is incremented to "02" thru "24". But I get
invalid qualifier errors. I moved the initialization code to a Public sub,
called from the Document_New, but still get the error. (I know that the code
below doesn't contan a loop, because I can't get it to work for just the
first iteration. )
Public Sub InitializeCategory()
Dim cbCategoryName As String
cbCategoryName = "cbCategory" & "01"
cbCategoryName.Clear
cbCategoryName.BackColor = cellWhite
cbCategoryName.ForeColor = cellBlack
End Sub
Any help would be appreciated,
TIA