|
Microsoft Office Application Development
|
|
Showing An Array On A Form; Autosizing ColumnWidths Of A ListBoxModule codeTo use the form, you can use this generic function: Public Function ShowTable(vTable As Variant, sTableTitle As String, bAutoColWidths As Boolean) As Variant You use the function like this:
Sub demo() ConclusionAs you've seen it takes a little bit of trickery to get this to work. We've used a (hidden) label control with AutoSize set to True and WordWrap to False. Then we fetch that label's width to determine the width the text will occupy in the listbox. CommentsAll comments about this page: Comment by: Andy Pope (5/15/2008 12:41:28 AM)This is exactly how I do my column sizing for listboxes. But there is no need to repeat the resize if you set the Width property to a larger value. Try setting it to 9999 and comment out the duplication. Comment by: Jan Karel Pieterse (5/15/2008 4:10:27 AM)Hi Andy, I adjusted the code based on a suggestion by Stephen Bullen and now the repeat is no longer needed. Add a comment too!!!
| ||||||||||||||
|
Use the contact page to issue
questions or comments about this website. |