Zorder doing strange things

  • Thread starter Thread starter Ken Soenen
  • Start date Start date
K

Ken Soenen

Can anybody explain what's going on here ?

Put two listboxes and two commandbuttons on a form and
partially overlap the two listboxes. The code below should
alternately bring to the front and then to the rear Listbox2.


Private Sub CommandButton1_Click()
ListBox2.ZOrder (0)
End Sub

Private Sub CommandButton2_Click()
ListBox2.ZOrder (1)
End Sub

Here is what I'm seeing:

1. Run the form and it works fine. (or it may not work)
2. close the form
3. add a blank(if necessary) to the code and do a SAVE
4. run the form again and now it DOES NOT Work.
5. you can keep doing this and it alternates from WORKING to
NOT WORKING every time you do a SAVE.

I'm using Excel 2003. WORD does the same thing.
 
Maybe just redrawing the userform would help:


Option Explicit
Private Sub CommandButton1_Click()
me.ListBox2.ZOrder 0
Me.Repaint
End Sub
Private Sub CommandButton2_Click()
me.ListBox2.ZOrder 1
Me.Repaint
End Sub
 
Dave,
Were you actually able to alternately make it work and fail by using
the SAVE from the menu bar? This seems really crazy.!!!
ken
 
I didn't use the save at all. I added me.repaint and it worked fine.



Ken said:
Dave,
Were you actually able to alternately make it work and fail by using
the SAVE from the menu bar? This seems really crazy.!!!
ken
 
Back
Top