Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Open the last file in a folder

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Open the last file in a folder

hi Spike

goto this address

http://www.j-walk.com/ss/excel/tips/tip97.htm

Regards Yngve

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Open the last file in a folder

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 253
Default Open the last file in a folder

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default Fileopen folder Wackyracer Setting up and Configuration of Excel 4 April 28th 23 03:43 AM
Open each file in a folder and closing it Ayo Excel Discussion (Misc queries) 3 September 22nd 08 09:03 PM
open file from folder save in new folder tim64[_3_] Excel Programming 20 June 17th 05 07:58 PM
How can i open a folder or file ΒΟΥΛΓΑΡΑΚΗΣ ΓΙΩΡΓΟΣ ΒΟΡΑΣ Excel Programming 2 November 2nd 04 03:20 PM
using macro to open every file in a folder wraithlead[_8_] Excel Programming 0 October 27th 04 08:07 AM


All times are GMT +1. The time now is 11:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"