modify some vb6 array code

I have some vb6 code that loops thru saved file and loads the filenames in a combobox
problem is some may exist and others not
Example filenames
9-20-2015.rtf
9-21-2015.rtf
9-25-2015.rtf
Yr9-20-2015.rtf
Yr10-25-2016.rtf
Dy1000.rtf
Wk10-25-2016.rtf
Mo10-25-2016.rtf
Yr10-25-2016.rtf
Wk10-25-2016.rtf
10-22-2016.rtf
10-21-2016.rtf
11-25-2016.rtf
Yr9-20-2016.rtf
Yr10-25-2016.rtf
Dy10-25-2016.rtf
Wk3-25-2016.rtf
Mo10-25-2016.rtf
Yr5-25-2016.rtf
Wk9-25-2016.rtf
Dy0630.rtf
Dy0900.rtf
Wk10-25-2016.rtf
Yr10-25-2016.rtf
Wk10-25-2016.rtf


Sub FillArrays()
Dim lngIndex As Long
If cboTasks.ListCount = 0 Then Exit Sub'first use will be empty
' Initialize the arrays
ReDim gArrDaily(0)  'example entry Da9-30-2015.rtf
ReDim gArrWeekly(0) 'example entry Wk9-30-2015.rtf
ReDim gArrMonthly(0) 'example entry Mo9-30-2015.rtf
ReDim gArrYearly(0) 'example entry Yr9-30-2015.rtf
ReDim gArrNoRepeat(0) 'example entry 9-30-2015.rtf


    ' Loop through the combox entries looking for a two-
    ' character identifier
    For lngIndex = 0 To cboTasks.ListCount - 1
        Select Case UCase(Left$(cboTasks.List(lngIndex), 2))
            Case "DY"
                ' Add the item to the mArrDaily array and increase
                ' the size of the array by 1 in preparation for
                ' the next entry
               gArrDaily(UBound(gArrDaily)) = cboTasks.List(lngIndex)
                ReDim Preserve gArrDaily(UBound(gArrDaily) + 1)
            Case "WK"
                gArrWeekly(UBound(gArrWeekly)) = cboTasks.List(lngIndex)
                ReDim Preserve gArrWeekly(UBound(gArrWeekly) + 1)
            Case "MO"
                gArrMonthly(UBound(gArrMonthly)) = cboTasks.List(lngIndex)
                ReDim Preserve gArrMonthly(UBound(gArrMonthly) + 1)
            Case "YR"
                gArrYearly(UBound(gArrYearly)) = cboTasks.List(lngIndex)
                ReDim Preserve gArrYearly(UBound(gArrYearly) + 1)
            Case Else
                gArrNoRepeat(UBound(gArrNoRepeat)) = cboTasks.List(lngIndex)
                ReDim Preserve gArrNoRepeat(UBound(gArrNoRepeat) + 1)
               
        End Select
    Next
    ' The "preparation for the next entry" leaves an empty
    ' array entry so get rid of them.
    ReDim Preserve gArrDaily(UBound(gArrDaily) - 1)
    ReDim Preserve gArrWeekly(UBound(gArrWeekly) - 1)
    ReDim Preserve gArrMonthly(UBound(gArrMonthly) - 1)
    ReDim Preserve gArrYearly(UBound(gArrYearly) - 1)
    ReDim Preserve gArrNoRepeat(UBound(gArrNoRepeat) - 1)
'End With
End Sub
How to write this in case some are not in the cbo ?
isnoend2001Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
If the problem is with the Redim Preserve statements at the end, just add On Error Resume Next before the first Redim Preserve
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
isnoend2001Author Commented:
Wil lthat work even if some are missing ?
0
Martin LissOlder than dirtCommented:
Try it:)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.