Consulting

Results 1 to 5 of 5

Thread: Possible via vba to check the datetime stamps on files in a directory?

  1. #1
    VBAX Regular
    Joined
    Jun 2012
    Posts
    14
    Location

    Question Possible via vba to check the datetime stamps on files in a directory?

    Must admit to not having got stuck into this requirement yet so maybe should have checked the functions etc.

    Basically I want to check a directory to see if a file has been written into it in the last half an hour by another process. One of those watchdog processes.

    Anyways is this possible?

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,730
    Location
    http://www.cpearson.com/excel/FileTimes.htm


    Chip's always got a lot of useful stuff on his site

    Paul

  3. #3
    [VBA]msgbox filedatetime("G:\OF\files.xls")[/VBA]

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    It sounds as if you need a combination of a macro that looks at all of the files in a nominated directory using Dir to get each file, and OnTime to fire the macro at preset intervals.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    OnTime or a Windows Scheduled task might be methods that you could use for VBA code. The OnTime method might work for you: http://www.mrexcel.com/forum/showthr...tcher-possible

    For something like that, I would probably use vb.net. I gave a lesson on how to do that at: http://www.wpuniverse.com/vb/showthr...ht=watchfolder

    If you don't want to register for free at WordPerfect Universe to see this lesson and my other vb.net lessons, explore these vb.net links on the topic:
    http://msdn.microsoft.com/en-us/libr...emwatcher.aspx
    http://www.vbdotnetheaven.com/upload...rol-in-VB-Net/
    http://www.codeproject.com/KB/dotnet/folderwatcher.aspx
    http://www.developerfusion.com/artic...ty-in-vbnet/2/

    Depending on your need, there are some ShellWait routines that can wait on a process, such as writing to a large text file, to complete before continuing on.
    Last edited by Kenneth Hobs; 06-29-2012 at 11:02 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •