J
Joanne
Hello, I have the following subroutine, which uses the variable "j" to
increment the names of different listboxes that I set up, the first being
"ListSchools1", but the macro always stops and tells me that this list box
doesn't exist. Isn't it possible to use a list box with a variable to
identify it?
Thank you for your help.
Sub AddEducationListInfo(varBookmark As String, varRecords As Long)
Dim rng As Range
Dim i As Integer
Dim j As Integer
j = 1
Dim strListInfo As String
Dim strDegreeInfo As String
Dim strHonorsInfo As String
Set rng = ActiveDocument.Bookmarks(varBookmark).Range
For i = 0 To varRecords
If frmAttyBio.ListSchools(j).Selected(i) = True Then
strDegreeInfo = frmAttyBio.ListDegrees(j).Value
strHonorsInfo = frmAttyBio.ListHonors(j).Value
strListInfo = frmAttyBio.ListSchools(j).List(i) & " " &
frmAttyBio.ListDegrees(j).Value _
& " " & frmAttyBio.ListHonors1(j).Value
End If
Next i
rng.Text = strListInfo
End Sub
increment the names of different listboxes that I set up, the first being
"ListSchools1", but the macro always stops and tells me that this list box
doesn't exist. Isn't it possible to use a list box with a variable to
identify it?
Thank you for your help.
Sub AddEducationListInfo(varBookmark As String, varRecords As Long)
Dim rng As Range
Dim i As Integer
Dim j As Integer
j = 1
Dim strListInfo As String
Dim strDegreeInfo As String
Dim strHonorsInfo As String
Set rng = ActiveDocument.Bookmarks(varBookmark).Range
For i = 0 To varRecords
If frmAttyBio.ListSchools(j).Selected(i) = True Then
strDegreeInfo = frmAttyBio.ListDegrees(j).Value
strHonorsInfo = frmAttyBio.ListHonors(j).Value
strListInfo = frmAttyBio.ListSchools(j).List(i) & " " &
frmAttyBio.ListDegrees(j).Value _
& " " & frmAttyBio.ListHonors1(j).Value
End If
Next i
rng.Text = strListInfo
End Sub