View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
blackpablo blackpablo is offline
external usenet poster
 
Posts: 1
Default VBA problem - prevent event to occur when certain button is clicked

Hi,
I have a VBA problem I just can't figure out.
I have a userform with, among others, a listbox, hidden label,
hidden image and a cancel button.
Now, what I already have is: when exiting the listbox (e.g. by going t
another control on the form) the hidden label and hidden image becom
visible and another listbox receives the focus.

Private Sub lbxArticles_Exit(ByVal Cancel As MSForms.ReturnBoolean)
lbxLotNumbers.SetFocus
imgArrow.Visible = True
lblWarning.Visible = True
End Sub

But when clicking the Cancel button the Exit event also occurs. So
always have to click the Cancel button twice to close the form.

Is there a way the let the Exit event occur except when the Cance
button is clicked ?

Thanks in advance,

Davi

--
Message posted from http://www.ExcelForum.com