Just paste create a new module and then paste this source code into it. You can name the module basListView.
'----------------------------------------------------------------------
'
' Module Name: basListView
' Written By: C&D Programming Corp.
' Create Date: 1/99
' Copyright: Copyright 1999 by C&D Programming Corp. Source
' code may not be reproduced except for use in a
' compiled executable. All rights reserved. If
' you would like to reprint any or all of this
' code please email us at info@codeoftheweek.com
'----------------------------------------------------------------------
Option Explicit
'
' The routines in this module require the Enhanced Comctl32 functionality that is only
' available to users with comctl32.dll version 4.70 or greater installed.
' This dll is typically installed with IE3 or IE4.
' You can download this update from http://msdn.microsoft.com/developer/downloads/files/40Comupd.exe
' For some additional details see http://www.codeoftheweek.com/updates/comctl.html
'
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal Msg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Const LVM_FIRST = &H1000
Private Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
Private Const LVS_EX_FULLROWSELECT = &H20
Private Const LVS_EX_GRIDLINES = &H1
Private Const LVS_EX_HEADERDRAGDROP = &H10
Private Const LVS_EX_TRACKSELECT = &H8
Public Sub lvFullRowSelect(lv As ListView, bFullRowSelectOn As Boolean)
Call SetExtendedOption(lv, LVS_EX_FULLROWSELECT, bFullRowSelectOn)
End Sub
Public Sub lvGridLines(lv As ListView, bGridLinesOn As Boolean)
Call SetExtendedOption(lv, LVS_EX_GRIDLINES, bGridLinesOn)
End Sub
Public Sub lvHeaderDragDrop(lv As ListView, bHeaderDragDrop As Boolean)
Call SetExtendedOption(lv, LVS_EX_HEADERDRAGDROP, bHeaderDragDrop)
End Sub
Public Sub lvTrackSelect(lv As ListView, bTrackSelect As Boolean)
Call SetExtendedOption(lv, LVS_EX_TRACKSELECT, bTrackSelect)
End Sub
Private Sub SetExtendedOption(lv As ListView, lOption As Long, bState As Boolean)
If bState Then
Call SendMessage(lv.hwnd, _
LVM_SETEXTENDEDLISTVIEWSTYLE, _
lOption, -1&)
Else
Call SendMessage(lv.hwnd, _
LVM_SETEXTENDEDLISTVIEWSTYLE, _
lOption, 0&)
End If
End Sub