Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Compare filename date to todays date

Posted on 2015-02-22
2
Medium Priority
?
61 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 54

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 40625133
Hi,

pls try

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

Regards
0
 

Author Closing Comment

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

810 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