Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you for your response.
"Jim Cone" wrote: The Microsoft Scripting Runtime (scrrun.dll) is included with all current versions of Windows. You can set a reference to it in Tools | References in the VBE or use late binding. An example... '--- Sub LatestFile() 'Jim Cone - San Francisco, USA - June 02, 2005 'Displays the latest file name in the strPath folder. Dim objFSO As Object Dim objFolder As Object Dim objFile As Object Dim strPath As String Dim strName As String Dim varDate As Variant ' Specify the folder... strPath = "C:\Program Files\Microsoft Office\Office\Library" ' Use Microsoft Scripting runtime. Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(strPath) ' Check date on each file in folder. For Each objFile In objFolder.Files If objFile.DateLastModified varDate Then varDate = objFile.DateLastModified strName = objFile.Name End If Next 'objFile ' Display file name in message box. MsgBox strName & " - is latest file - " & varDate Set objFSO = Nothing Set objFolder = Nothing Set objFile = Nothing End Sub '--- Also see... http://www.microsoft.com/downloads/d...DisplayLang=en -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "Manuelauch" wrote in message Jim Cone I do not understand what you mean by (Scripting) FileSystemObject |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pulling pdf files from general folder to specific folder | Excel Discussion (Misc queries) | |||
Creating a unique list of Cost Codes in Col. A from all worksheets in all workbooks in folder X | Excel Programming | |||
User selection of folder and open all .xls files within folder | Excel Programming | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Discussion (Misc queries) | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Programming |