View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
driller driller is offline
external usenet poster
 
Posts: 740
Default macro function--very nice

Hello genuine guys,

Is the macro function <see below here still possible for adjustment so I
can use this very good macro, productively, as often as needed ? Data to
build are "filenames" <i.e. €œ*.pdf€,..

Steps Criteria :
Source address is in A1
1st the generated list of filenames shall be on Col A2~C, start row 2
2nd the next generated list of filenames (e.g. after re-using the function
again) shall append/build-up from the bottom of previously generated row of
data.

The filenames are searched from a folder address as written in A1.
This folder stores files in a daily basis.
Bottom line, I have to perform a routine listing of filenames without
re-building the previously gathered filenames.

--
Sub FilelistUpdates()
Dim fso As Object, folder As Object
Dim lngRow As Long, ws As Worksheet
Set fso = CreateObject("Scripting.FileSystemObject")

For Each ws In Worksheets
ws.Range("A2:C2").Resize(ws.Cells(Rows.Count,
"A").End(xlUp).Row).ClearContents

If fso.FolderExists(ws.Range("A1")) Then
Set folder = fso.GetFolder(ws.Range("A1"))
lngRow = 2

For Each fl In folder.Files
'ws.Range("A" & lngRow).Formula = "=hyperlink(""" & folder.Path & "\" &
fl.Name & """,""" & fl.Name & """)"
ws.Range("A" & lngRow).Formula = "=hyperlink(""" & folder.Path & "\" &
fl.Name & """,""" & fl.Parentfolder.Name & "\" & fl.Name & """)"

ws.Range("B" & lngRow) = fl.Size
ws.Range("C" & lngRow) = fl.DateLastModified
lngRow = lngRow + 1
Next

End If
Next
End Sub
--
The above macro works for me yesterday, then when i re-hit the function
today, the new list are generated and the yesterday's filename list were
rearranged.
I have already written working/recording notes along Col. D for each
filename yesterday and now I have to re-arranged it <where it fits all over
again...

I am not familiar yet with ms access..i believe excel is more powerful and
flexible..
--
Regards ïŠ