Adding textbox filter to listbox?
I have a listbox using the code form slipstick.com/developer/code-samples/outlook-vbatext-file-list/ . It populates the listbox with job numbers for saving emails to the server. I would like to add a text box to enter a keyword to filter the listbox. The only examples I can find are for excel, such as this one yoursumbuddy.com/listbox-filter-wildcards-unique-values/.
Does anyone know/have a code example for adding a filter to the listbox in Outlook?
Here is the code I'm using to populate the listbox:
Code:
Private Sub UserForm_Initialize()
Dim fn As String, ff As Integer, txt As String
fn = "H:\Software\OutlookVBA\project_list.txt" '< --- .txt file path
txt = Space(FileLen(fn))
ff = FreeFile
Open fn For Binary As #ff
Get #ff, , txt
Close #ff
Dim myArray() As String
'Use Split function to return a zero based one dimensional array.
myArray = Split(txt, vbCrLf)
'Use .List method to populate listbox.
ListBox2016.List = myArray
lbl_Exit:
Exit Sub
Thanks,
Chris