Adding textbox filter to listbox?

framednlv

New Member
Outlook version
Outlook 2016 64 bit
Email Account
Exchange Server
#1
I have a listbox using the code form Outlook VBA: Use a Text File to Populate a ListBox . 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 here.

Does anyone know/have a code example for adding a filter to the listbox in Outlook?

Thanks,
Chris
 
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
#2
I don't have any examples, but the same general method should work in Outlook. you can download the workbook sample, export the userform and then you just need to cleanup the code to use your data source (that's the hard part :)).
 

framednlv

New Member
Outlook version
Outlook 2016 64 bit
Email Account
Exchange Server
#3
I really would like to do this, so perhaps one step at a time.
How can I add a second column to the listbox, current code for the list box (thank you Diane):

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)'I'm guessing it would need to be modified here?
  'Use .List method to populate listbox.
  ListBox2016.List = myArray
lbl_Exit:
  Exit Sub
End Sub
 

Similar threads

Top