Excel VBA Multipage and ListView Bug

I’m going back to my roots on a small consulting job and hacking together a tracking system in Excel with some VBA forms thrown in for giggles. I’ve come across a redraw bug when you put a ListView control on a MultiPage control. For whatever reason the first redraw of the form displays the ListView at position 0,0 of the MultiPage regardless of where you positioned it in the designer. This ListView moves to the correct location when you either change the current page of the MultiPage or drag the form but clearly this isn’t a great solution. I came up with another solution that seems to have worked pretty well. Just force a re-draw of the ListView whenever the MultiPage is clicked.

Private Sub MultiPage1_Click(ByVal Index As Long)
  'workaround for redraw problem with listview in multipage
  Me.lvwResearchers.Visible = False
  Me.lvwResearchers.Visible = True
End Sub
This entry was posted in Software on by .

About markn

Mark is the owner and founder of Timesheets MTS Software, an mISV that develops and markets employee timesheet and time clock software. He's also a mechanical engineer, father of four, and a lifelong lover of gadgets.