Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-23-2021, 08:55 PM
Guessed's Avatar
Guessed Guessed is offline Search Para No(s). thru Autofilter Combobox Windows 10 Search Para No(s). thru Autofilter Combobox Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Those constants are all defined in Excel. In Excel these resolve as


xlBeginsWith = 2
xlContains = 0
xlDoesNotContain = 1
xlEndsWith = 3
xlNoFilter = ""

The ComboBox in a VBA userform is essentially the same but when interacting with the application may cause you to use different methods to achieve the same thing. For instance a Range in Excel can be used to populate the .List property of a combobox. Word requires you to convert a Range into an array before you can populate the .List property.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #2  
Old 02-23-2021, 09:28 PM
SMehta SMehta is offline Search Para No(s). thru Autofilter Combobox Windows 10 Search Para No(s). thru Autofilter Combobox Office 2013
Novice
Search Para No(s). thru Autofilter Combobox
 
Join Date: Jan 2021
Posts: 29
SMehta is on a distinguished road
Default

In order to avoid confussion. i Ve changed as per Word Requirements only the SELECT CASE part

Code:
Private Sub ComboBox1_Change()
    Dim oneItem As Variant
    Dim FilteredItems() As String
    Dim NotFlag As Boolean
    Dim Pointer As Long, i As Long
    
    If DisableMyEvents Then Exit Sub
    If AbortOne Then AbortOne = False: Exit Sub
    If TypeName(FullList) Like "*()" Then
        ReDim FilteredItems(1 To UBound(FullList))
        DisableMyEvents = True
        Pointer = 0
        With Me.ComboBox1
            Select Case FilterStyle
                Case 2: .Tag = LCase(.Text) & "*"
                Case 0: .Tag = "*" & LCase(.Text) & "*"
                Case 1: .Tag = "*" & LCase(.Text) & "*": NotFlag = True
                Case 3: .Tag = "*" & LCase(.Text)
                Case "": .Tag = "*"
            End Select
            
            For Each oneItem In FullList
                If (LCase(oneItem) Like .Tag) Xor NotFlag Then
                    Pointer = Pointer + 1
                    FilteredItems(Pointer) = oneItem
                End If
            Next oneItem
            
            .List = FilteredItems
            .DropDown
        
        DisableMyEvents = False
            If Pointer = 1 Then .ListIndex = 0
        End With
    End If
End Sub
Also Checked the following code Not At all Required
Code:
Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

IsArrow = KeyCode = vbKeyUp Or KeyCode = vbKeyDown
If KeyCode = vbKeyReturn Then ComboBox1.List = FullList 
End Sub
And Where to Apply appropriate Msgbox as post #6

SMehta
Thread 3: No: 46521 : Post No12 : TM 25
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to get number of para in Combobox SMehta Word VBA 2 02-20-2021 07:15 AM
How to autofilter by exact date? LearnerExcel Excel 5 06-19-2018 03:30 PM
Autofilter on two Date Columns OTPM Excel Programming 3 04-29-2014 12:56 AM
Search Para No(s). thru Autofilter Combobox Sum on AutoFilter Grasshopper Excel 3 02-14-2013 01:41 AM
Search Para No(s). thru Autofilter Combobox AutoFilter Criteria3 coxjamd Excel Programming 2 01-17-2013 02:24 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft