Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would be very grateful for some code to open the last file in a folder.
They are date stamped but the date might not be known!! So it really has to be the last one no matter what date it is! -- with kind regards Spike |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Grand
Many thanks much appreciated -- with kind regards Spike "Yngve" wrote: hi Spike goto this address http://www.j-walk.com/ss/excel/tips/tip97.htm Regards Yngve |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Spike,
This is using Microsoft Scripting Runtime library (fileSystemObject) Function ShowLastfile(folderspec As String) As String Dim fso, f, f1, fc Dim sFileName As String Dim dDate As Date Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(folderspec) Set fc = f.Files For Each f1 In fc If dDate < f1.datecreated Then dDate = f1.datecreated sFileName = f1.Name End If Next ShowLastfile = sFileName End Function Sub test() MsgBox ShowLastfile("C:\Temp\") End Sub Regards Jean-Yves "Spike" wrote in message ... I would be very grateful for some code to open the last file in a folder. They are date stamped but the date might not be known!! So it really has to be the last one no matter what date it is! -- with kind regards Spike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Default Fileopen folder | Setting up and Configuration of Excel | |||
Open each file in a folder and closing it | Excel Discussion (Misc queries) | |||
open file from folder save in new folder | Excel Programming | |||
How can i open a folder or file | Excel Programming | |||
using macro to open every file in a folder | Excel Programming |