PDA

View Full Version : multiple questions about listboxes



dlh
08-30-2008, 03:01 PM
Is there a way to autosize the width of a column in a multi-column listbox based on the width of its entry?

Also is there a *simple* way to automatically expand or shrink a listbox vertically (and the userform which contains it, too) based on the number of rows? Something that doesn't involve calculating sizes and positions of everything based on font dimensions. Can one specify a maximum size so that it doesn't grow larger than the screen?

Is there a way to use multiple fonts in a listbox? For example, could one use a different font for each column (or even within a single column)?

My naive guess is that the answers to each of these questions is "no." I'd appreciate any information either way. Thank you for reading.

TomSchreiner
08-31-2008, 03:13 PM
Yes, Yes, Not that I know of (maybe API? ) (you can use multiple listboxes side by side to reproduce the behavior in your third question)... :)

dlh
08-31-2008, 10:47 PM
Thank you for the reply, but please, there must be more information you can provide than this. Some hint or link? My own searches have come up empty.

Working in particular on the autosize-listbox-column question, I've found references to a TextWidth Method for Forms which looks very promising, but that seems to be only for Access or an older version of VBA. I cannot find it in VBA 6.5 with Excel.

Update: I've found a Class that someone has written and made available online to replicate a TextWidth-type function. Link: http://www.vbforums.com/showpost.php?p=1967604&postcount=8 (It will take a while to figure out how it works; this is my first encounter with a custom Object). I'd still appreciate any insight or simpler solutions to the questions above.