I have the below code for an AxtiveX combo box, which appears on sheet12.
Sub Agent_Options()
Application.EnableEvents = False
With CB_Agent_Select 'CB_Agent_Select is an ActiveX Combo Box, which appears on Sheet12
.Clear
.ColumnCount = 2
.ColumnWidths = "60;140.5"
.ListRows = 7
'The "AddItem" and "List...) lines essentially concatenates
'the values to read "IG-01 Argon" in the combo box.
.AddItem "IG-01"
.List(0, 1) = "Argon"
.AddItem "IG-55"
.List(1, 1) = "Argon / Nitorgen"
.AddItem "IG-100"
.List(2, 1) = "Nitrogen"
.AddItem "IG-541"
.List(3, 1) = "Argon / Nitrogen/ CO2"
.AddItem "FK-5-1-12"
.List(4, 1) = "Novec"
.AddItem "HFC-23"
.List(5, 1) = "FE-13"
.AddItem "HFC-125"
.List(6, 1) = "Ecaro"
.AddItem "HFC-227ea"
.List(7, 1) = "FM-200"
'.AddItem "HFC-236fa"
'.List(8, 1) = ""
'.AddItem "HFC Blend B"
'.List(9, 1) = ""
End With
Application.EnableEvents = True
'This code examinst the users choice from the "Combo Box".
'At this time there is limited calculation methods so this
'warning advised the user to the limited calculation methods available
If CB_Agent_Select.ListIndex = -1 Then
MsgBox "The Ansul Inert Calculation Method Has Not Been Developed" & vbCrLf & "At Present, Only FM-200 Agent May Be Calculated", vbCritical, "Ansul Inergen Calc"
End If
End Sub
I'm having the following problems:- The combo box displays the concatenated value correctly (IG-01 Argon) when I'm in the box, but not after the selection is made. It then only shows the "IG-01" value. What am I doing wrong?
- The MsgBox is trying to test for the value selected by the user. I've tried 0, 1, and -1 to get the message to fire but it's not. It should fire with "EITHER" the 1st, 2nd, OR 3rd "AddItem" but it's not firing on anyone of the selections. Any ideas?
- Can the ".AddItem..." and ".List", be written differently or on a single line?
Bookmarks