Link to home
Start Free TrialLog in
Avatar of sidwelle
sidwelleFlag for United States of America

asked on

Set the column header text of a VBA ListBox via code ?

How can I set the column headers of a VBA ListBox with multiple columns ?

Searching I found documentation that states the only way to set header text is to set them fields from a table ?  Others recommended floating textboxes about the header ?

Found some other examples, but they did not work.


Is there not a simple way to set the column header text by code only ?

Avatar of ste5an
ste5an
Flag of Germany image

It solely depends on the used ListBox component. E.g., DevExpress or Telerik provides that.
Avatar of sidwelle

ASKER

I Don't  understand, its the standard ListBox that comes with Excel.
Are you referring to 3rd party components ?
I need to stick w/whats native.
Is your listbox in a userform?
Yes
Works, but uses a SS.
Still looking for a way to do it w/o a Spreadsheet ?

What if I want the column name to be dynamic ?  (Change is after the app starts)

Thanks
Maybe something like this?
29254322a.xlsm
ASKER CERTIFIED SOLUTION
Avatar of sidwelle
sidwelle
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You should probably use labels (one for each column) rather than a listbox.
Yes, but my listbox has checkbox(s) to the left on each item.
Adding another listbox w/Chks just above it (touching) looks like it is supposed to be there and keeps all the borders and shadings like the original with the chk lined up above the other one.  "Looks like it's supposed to be there."

Could use labels and a chkbox, but could also be a lot more work ?   This is the simple solution !, for one box not too bloated.  If I was making an array of boxes, yes I would look into using labels.

Thanks