Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Locating Latest Workbook
Hi,
Which command do I use to locate the latest workbook in A Folder, I have a series of Excel workbooks, they are named by the date they were saved i.e. List 01-12-04 List 08-12-04 List 15-12-04 etc.etc. So Far I have sub fold() dim i i = C:\My Documents\Workbooks.Count MsgBox C:\My Documents\Workbooks(i) End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Locating Latest Workbook
Hi
Function LatestFile(Folder As String, _ sType As String) As String Dim Dt As Date Dim NextFile As String NextFile = Dir(Folder & "\" & sType) Do Until NextFile = "" If FileDateTime(Folder & "\" & NextFile) Dt Then _ LatestFile = NextFile NextFile = Dir() Loop End Function Sub test() MsgBox LatestFile("C:\Temp", "*.*") MsgBox LatestFile("C:\Temp", "*.rtf") MsgBox LatestFile("C:\Temp", "*.xl*") End Sub HTH. Best wishes Harald "teresa" skrev i melding ... Hi, Which command do I use to locate the latest workbook in A Folder, I have a series of Excel workbooks, they are named by the date they were saved i.e. List 01-12-04 List 08-12-04 List 15-12-04 etc.etc. So Far I have sub fold() dim i i = C:\My Documents\Workbooks.Count MsgBox C:\My Documents\Workbooks(i) End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Latest Taxation Books available at jain book depot LATEST BOOKRELEASES | Excel Worksheet Functions | |||
Locating if a Sheet is present in a workbook | Excel Discussion (Misc queries) | |||
Locating a Worksheet from another Workbook | Excel Worksheet Functions | |||
LOCATING A CHART SAVED IN A WORKBOOK | Excel Discussion (Misc queries) | |||
Find a workbook and "overwrite it with the latest Excel format" | Excel Programming |