DropButtonclick event and list showing

  • Thread starter Thread starter Stopher
  • Start date Start date
S

Stopher

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,

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top