Results 1 to 2 of 2
  1. #1
    Lounger
    Join Date
    Mar 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Autosize cols. in ListView (2003)

    Oooops... you also need this:

    Private Declare Function SendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

  2. #2
    Lounger
    Join Date
    Mar 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Autosize cols. in ListView (VB/VBA)

    Hi folks,

    I made this function for autosizing LV's. You can have it if you like:

    Longish code moved to attachment by HansV - preserves indentation too <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    You use it like ihis:

    VBAAutoSizeLVCols(lvMyListView) ' = Auto size all cols. taking width of col.headers into account.
    VBAAutoSizeLVCols(lvMyListView, false) ' Auto size all cols. NOT taking width of col.headers into account.

    VBAAutoSizeLVCols(lvMyListView, true, 3) ' Auto size 3'th col. taking width of col.header into account.
    VBAAutoSizeLVCols(lvMyListView, false, 3) ' Auto size 3'th col. NOT taking width of col.header into account.

    Col.# are 1-based.

    I've tested it so-so and it works fine to me.


    Regards,
    Michael.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •