Userform listbox not registering selection after upgrade to MS 2016

abking1992

New Member
Joined
Nov 13, 2015
Messages
7
Private Sub fruitList_Click()


End Sub



Private Sub UserForm_Initialize()
With fruitList
.AddItem "BANANA"
.AddItem "APPLE"
.AddItem "ORANGE"
.AddItem "PINEAPPLE"

End With
End Sub
wb1.Activate


'Dim xlApp As Excel.Application
'ReadOnly fruitdata16
'Set xlApp = CreateObject("Excel.Application")
'xlApp.Visible = True
'xlApp.Workbooks.Open fileName:=fruitdata16


'Identify fruit Workbook name'
'MsgBox ActiveWorkbook.name, vbInformation, "Workbook Name"
bprWb = ActiveWindow.Caption
Sheets("NA Fruit Data").Select
fruitChosen = fruitList.Value
lastrowFinal = ActiveSheet.Cells(Rows.count, "A").End(xlUp).row
'MsgBox lastrowFinalWB3
wb1.Activate
If fruitChosen = "APPLE" Then
FilterAPPLE lastrowFinal, wb1
ElseIf fruitChosen = "BANANA" Then
FilterBAN lastrowFinal, wb1
ElseIf fruitChosen = "ORANGE" Then
FilterORANGE lastrowFinal, wb1
ElseIf fruitChosen = "PINEAPPLE" Then
FilterPA lastrowFinal, wb1
Else
MsgBox "Please choose your fruit"
End
End If


Above is the code used to choose the user's fruit of choice (changed to fruit for confidentiality). Basically, this userform will list all fruit and the user selects one. This works in MS 2010 package. Our company is rolling out updates to MS 2016 and now the macro will consistently produce a message box saying "Please choose your fruit" i.e. not registering the userform selection.

I was able to see on a computer it wasn't working, it references a MS Object Library 16.0 and I'm currently running 14.0 (macro still works for me).

I have tried clearing *.exd files from his C drive, but it still did not help.

Any ideas? Thanks in advance.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Here's what I would do. Uncheck the MS Office Object Library 14.0, then go to Debug - Compile VBA Project. See where you get the error.
If you're using something like:
Code:
Set xlApp =Excel.Application
you'd want to use something like what I see in your code above:

Code:
Set xlApp = CreateObject(Excel.Application)
... this is what you'd want to use. Basically you need to use late binding when using the 2 different Excel versions.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,243
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top