LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Txt file properties

Awesome, that worked perfectly. Thank you for the assistance!
Keith

"Bob Phillips" wrote in message
...
See if you can work with this

Dim oFS As Object
Dim oFile As Object

Set oFS = CreateObject("Scripting.FilesystemObject")
On Error Resume Next
Set oFile = oFS.getfile("C:\test\SP Test.xls")
On Error GoTo 0
If Not oFile Is Nothing Then
MsgBox CDate(oFile.DateLastModified)
End If

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Keith R" wrote in message
...
XL2003 on WinXP

I'm piecing together VBA code to identify if a target file exists, and if
so, to open it and parse it into memory and further calculations (file is
under 65K lines). The text file is created within MS Outlook using a
macro to dump an email (report from a mainframe) to the text file.

When my XL macro is run, I want to check the last saved date of the txt
file; if it was the same day (today) then the report should run without
interruption. If the txt file was saved prior to the same day, I plan to
throw an alert and allow the user to decide whether to continue (txt file
is recent enough) or cancel (to go back and find more recent data).

I can handle the logic of the date comparison and the alert box; but I'm
struggling with how to identify the last saved date of the text file.
I've appended the relevant lines of code below; what should I add as my
5th line to pull the last saved date of this file, if it exists?

Many thanks,
Keith

Application.StatusBar = "Loading Backlog Data File"
Set mywrksht = MySheetArray(WhichFile)
LongFN = tPath & MyFileNameArray(WhichFile) & tSuffix
If Dir(LongFN) = MyFileNameArray(WhichFile) & tSuffix Then 'tells
me if file exists (?)

'something like: TxtDate = Dir(LongFN).attributes.lastsaveddate

'...code continues here





 
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
File Properties TerryTutor Excel Discussion (Misc queries) 2 August 30th 07 06:06 PM
File Properties ALEX Excel Discussion (Misc queries) 1 February 8th 07 02:47 PM
File Properties Kaval Excel Programming 5 July 20th 06 06:03 AM
Properties transferring from excel cells to word file properties lubo Excel Programming 4 July 12th 05 11:24 AM
Set properties in an XLS file.. S Ayyar Excel Programming 0 December 9th 03 08:51 PM


All times are GMT +1. The time now is 04:20 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"