Solved

Compare filename date to todays date

Posted on 2015-02-22
2
51 Views
Last Modified: 2015-02-22
I am trying to make a personal reminder program.
Compare file names to todays date

I have files that are saved with the files date as the name
the file names are loaded into a listbox
02-20-2015.rtf
02-21-2015.rtf
02-22-2015.rtf
02-20-2016.rtf


 Private Sub lstTasks_Click()
   Dim myDate As Date
        myDate = Len(lstTasks.Text) - 4 'minus extension        
    If myDate = Date Then ' a new task to handle
        Call MsgBox("You have a scheduled task to consider", vbInformation, "Needs attention")
        'call load the rtf file here to richtextbox
    End If
End Sub

this code produces
Debug.Print myDate = 1/9/1900
how can this be fixed ?
0
Comment
Question by:isnoend2001
2 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
Comment Utility
Hi,

pls try

myDate = DateValue(Left(lstTasks.Text, Len(lstTasks.Text) - 4))

Regards
0
 

Author Closing Comment

by:isnoend2001
Comment Utility
Thanks
I have found this:
myDate = CDate(Left$(lstTasks.Text, Len(lstTasks.Text) - 4)) and it also works
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now