nigelandrewfoster
Well-known Member
- Joined
- May 27, 2009
- Messages
- 747
Any suggestions? Error occurs at highlighted line. I'm stumped, I confess:
Thanks!
Code:
Function List_Open_Workbooks(lngPermitted As Long, ParamArray strSuffix() As Variant) Dim wbOpen As Workbook
Dim rngOpenWorkbooks As Range
Dim strFilename As String
Dim strWbSuffix As String
Dim bytsuffix As Byte
Dim blnSuffixAccepted As Boolean
Dim blnCheckSuffix As Boolean
frmWorkbookSelect.lstWorkbookSelector.MultiSelect = -(lngPermitted > 1)
blnCheckSuffix = strSuffix(0) <> "*"
With ThisWorkbook.Worksheets("Workpad")
.[a2:a65535].Delete Shift:=xlUp
For Each wbOpen In Workbooks
If wbOpen.Name <> ThisWorkbook.Name Then
If blnCheckSuffix Then
blnSuffixAccepted = False
[FONT=arial black] strWbSuffix = strSuffix(wbOpen.Name)[/FONT]
For bytsuffix = 0 To UBound(strSuffix)
If strSuffix(bytsuffix) = strWbSuffix Then blnSuffixAccepted = True
Next
Else
blnSuffixAccepted = True
End If
If blnSuffixAccepted Then .[a65535].End(xlUp).Offset(1).Value = wbOpen.Name
End If
Next
frmWorkbookSelect.lstWorkbookSelector.RowSource = "Workpad!A2:" & .[a65535].End(xlUp).Address
End With
frmWorkbookSelect.Show
End Function
Function strSuffix(strFilename As String) As String
Dim bytDot As Byte
bytDot = InStrRev(strFilename, ".")
If bytDot > 0 Then strSuffix = Right(strFilename, Len(strFilename) - bytDot)
End Function
Thanks!