Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / September 2006

Tip: Looking for answers? Try searching our database.

Last ModifiedDate -15 days

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SteveH - 13 Sep 2006 10:17 GMT
I have a function which does the following:

1. Remove .xls from the file and use reminder as a wild card by
additing * at both the ends
2. Query the directory (source path) for the wild card
3. Check the data stamp on each file matching the card
4. Pick up the latest file

I now need the function to only process a file the last modified date
is less than 15days old. How can I do this?

Easy question I am sure but I cannot think of the answer.

Many thanks
SteveH
Bob Phillips - 13 Sep 2006 10:45 GMT
when you get the fie date check that like

   If File_Date > Date -15 Then
       ...

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

> I have a function which does the following:
>
[quoted text clipped - 11 lines]
> Many thanks
> SteveH
SteveH - 13 Sep 2006 11:12 GMT
Ok so I need to add  to the following statement:

If oFile.DateLastModified > dtLastUpdated Then
                   sLatestFile = oFile.Name
                   dtLastUpdated = oFile.DateLastModified
               End If

so it looks like :

If oFile.DateLastModified > dtLastUpdated Then
            If File_Date < Date -15 Then
                   sLatestFile = oFile.Name
                   dtLastUpdated = oFile.DateLastModified
               End If

I am not sure what Else clause I should put in here. Basically, if it
is older than 15days I want it to be ignored and a msgbox to be shown
saying "File needs updating" or something similar.

> when you get the fie date check that like
>
[quoted text clipped - 23 lines]
> > Many thanks
> > SteveH
SteveH - 13 Sep 2006 11:58 GMT
I have updatedthe following statement in my function to the following:

              If oFile.DateLastModified > dtLastUpdated Then
                   If oFile.DateLastModified < Date - 15 Then
                      sLatestFile = oFile.Name
                      dtLastUpdated = oFile.DateLastModified
                   Else
                   MsgBox ("Spreadsheet has not been Updated")
                   End If
                End If

When I test this by using a spreadsheet qith a LastModifiedDate of
13/07/2006 I would expect it NOT to be process and recieve the msg
above. However the file is being processed as normal.Can someone
pleeeeease tell me what is wrong with my syntax before I go nuts!

Thanks

> when you get the fie date check that like
>
[quoted text clipped - 23 lines]
> > Many thanks
> > SteveH
Bob Phillips - 13 Sep 2006 12:08 GMT
You have the test the wrong way round, your test will check for files MORE
than 15 days old.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

> I have updatedthe following statement in my function to the following:
>
[quoted text clipped - 41 lines]
> > > Many thanks
> > > SteveH
SteveH - 13 Sep 2006 12:50 GMT
I have switched it roudn but it still seems to be ignoring this
statement and processing anyway.
> You have the test the wrong way round, your test will check for files MORE
> than 15 days old.
[quoted text clipped - 51 lines]
> > > > Many thanks
> > > > SteveH
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.