PDA

View Full Version : Help me creating files index



drico78
04-09-2008, 05:00 PM
Hi all!
I have a big problem.
I created a worksheet that have 4 buttons.
1 - I select a folder to populate the sheet with filenames, modified date and size;
2 - Clean all cells;
3 - Open this directory folder and
4 - Find a specific row by name.
I wanna also add another fields, like comments or keyword when I select a directory to make a index.
Would anyone help me?
Thx!

Oorang
05-02-2008, 06:35 AM
Is this what you mean?
[Public Sub Example()
Const lngClmnFldr_c As Long = 1
Const lngClmnFlNm_c As Long = 2
Dim fso As Object
Dim fl As Object
Dim dlg As Office.FileDialog
Dim lngRow As Long
Dim ws As Excel.Worksheet
Set dlg = Excel.Application.FileDialog(msoFileDialogFolderPicker)
dlg.Title = "Select Folder"
dlg.ButtonName = "Select"
If Not dlg.Show Then
Exit Sub
End If
Set ws = Excel.ActiveWorkbook.Worksheets.Add
ws.Name = "ExampleOutput"
Set fso = CreateObject("Scripting.FileSystemObject")
For Each fl In fso.GetFolder(dlg.SelectedItems(1)).Files
lngRow = lngRow + 1
ws.Cells(lngRow, lngClmnFldr_c).Value = fl.Path
ws.Cells(lngRow, lngClmnFlNm_c).Value = fl.Name
Next
End Sub

Aussiebear
05-02-2008, 08:06 AM
Hi all!
I have a big problem.
I created a worksheet that have 4 buttons.
1 - I select a folder to populate the sheet with filenames, modified date and size;
2 - Clean all cells;
3 - Open this directory folder and
4 - Find a specific row by name.
I wanna also add another fields, like comments or keyword when I select a directory to make a index.
Would anyone help me?
Thx!

Hi drico78, Welcome to the forum. Can you please post a workbook with your buttons so we can see what you are doing?