Hi all,
I'm trying to resize a listbox (and its frame and form) to fit the items in the listbox...simple I'm sure, so I must be going about it in the wrong way. Can anyone point me in the right direction? The code I'm using at the moment is below...
Thanks in advance
With frm.List
For i = 0 To (.ListCount - 1)
If TextWidth(.List(i)) > NewWidth Then
NewWidth = TextWidth(.List(i))
End If
Next i
If NewWidth > .Width Then
WidthDiff = (NewWidth - .Width + 10)
frm.Width = frm.Width + WidthDiff
frm.fra.Width = frm.fra.Width + WidthDiff
.Width = (NewWidth + 10)
End If
End With
I'm trying to resize a listbox (and its frame and form) to fit the items in the listbox...simple I'm sure, so I must be going about it in the wrong way. Can anyone point me in the right direction? The code I'm using at the moment is below...
Thanks in advance
With frm.List
For i = 0 To (.ListCount - 1)
If TextWidth(.List(i)) > NewWidth Then
NewWidth = TextWidth(.List(i))
End If
Next i
If NewWidth > .Width Then
WidthDiff = (NewWidth - .Width + 10)
frm.Width = frm.Width + WidthDiff
frm.fra.Width = frm.fra.Width + WidthDiff
.Width = (NewWidth + 10)
End If
End With