![]() |
DropButtonclick event and list showing
Hi All,
I have a script that populates a cbo on activation, the user selects a few options and slowly builds a list to create a txt file. The issue I have is if the final list box is populated with anything then you cannot change the cbo, so what I have done is added a dropButtonClick event into the script as below: Private Sub cboApp_DropButtonClick() If cboApp.Value < " " And lstSampList.ListCount < 0 Then vbReset = MsgBox("A list has already been started for " & cboApp.Value & vbCr & "Due to the restrictions on the XRF only one list can be created at one time for each application." & vbCr & "Press OK to restart or cancel to continue", vbOKCancel) If vbReset = vbOK Then UserForm_Activate Else lstBatch_Click End If End If End Sub the issue I have is that on the else the list box drop down is still activated and the list appears, this triggers this event to happen again and you have to push cancel again to truely cancel. My question is in my Else what can i put in to prevent the list from showing, thus creating a mini loop. Regards Stopher |
DropButtonclick event and list showing
On Apr 27, 8:50 am, Stopher wrote:
Hi All, I have a script that populates a cbo on activation, the user selects a few options and slowly builds a list to create a txt file. The issue I have is if the final list box is populated with anything then you cannot change the cbo, so what I have done is added a dropButtonClick event into the script as below: Private Sub cboApp_DropButtonClick() If cboApp.Value < " " And lstSampList.ListCount < 0 Then vbReset = MsgBox("A list has already been started for " & cboApp.Value & vbCr & "Due to the restrictions on the XRF only one list can be created at one time for each application." & vbCr & "Press OK to restart or cancel to continue", vbOKCancel) If vbReset = vbOK Then UserForm_Activate Else lstBatch_Click End If End If End Sub the issue I have is that on the else the list box drop down is still activated and the list appears, this triggers this event to happen again and you have to push cancel again to truely cancel. My question is in my Else what can i put in to prevent the list from showing, thus creating a mini loop. Regards Stopher Hi All, Think I fixed it, just reiterated the value as the stored value and setfocus on another lstbox cboApp.Value = cboApp.Value lstBatches.SetFocus Hope this may help someone in the future, or maybe there is a better solution. |
All times are GMT +1. The time now is 05:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com