![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a callback function that populates a listbox with a list of file names in a folder. This code came from Terry Kreft/Dev Ashish some years ago. I now want to add another column to the list box to display the date of the file. I have started modifing the code to handle a 2 coulmn array, but it dosnt look like I can just change the variable to an array. Here is the code with my hichlights where I started changing it to an array with the seconf column to hold the date. --------------------code------------------ Function fListFill(ctl As Control, varID As Variant, lngRow As Long, _ lngCol As Long, intCode As Integer) As Variant Static sastFiles() As String Static slngCount As Long Static sloclDir As mdl_ListFiles_clsDir Dim i As Long 'Dim varRet As Variant Dim varRet() As Variant <--- changed Dim X As Long Select Case intCode Case acLBInitialize Set sloclDir = New mdl_ListFiles_clsDir If Not mstFilePath = vbNullString _ Then With sloclDir .FillFiles mstFilePath slngCount = .GetFileCount If slngCount > 0 Then 'ReDim sastFiles(0 To slngCount-1) ReDim varRet(0 To slngCount - 1, 2) --changed ReDim sastFiles(0 To slngCount - 1, 2) --added For i = 1 To slngCount 'sastFiles(i - 1) = .NameOfFile(i) sastFiles(i - 1, 1) = .NameOfFile(i) --changed sastFiles(i - 1, 2) = .DateOfFile(i) --added ***not sure if this is valid expression*** Next i PDF_accSortStringArray sastFiles() End If End With Else slngCount = 0 End If varRet = True **** cant set this if its an array***** Case acLBOpen varRet = Timer Case acLBGetRowCount varRet = slngCount Case acLBGetValue If slngCount > 0 Then 'varRet = sastFiles(lngRow) varRet(lngRow, 1) = sastFiles(lngRow, 1) <--changed varRet(lngRow, 2) = sastFiles(lngRow, 2) <--added Else 'varRet = vbNullString varRet(lngRow, 1) = vbNullString <--changed varRet(lngRow, 2) = vbNullString <--added End If Case acLBEnd Set sloclDir = Nothing Erase sastFiles End Select fListFill = varRet End Function ----------end code---------------- Any suggestions how to get the date of the file and populate the listbox??? |
![]() |
| Thread Tools | |
| Display Modes | |
| |