Solved

Compare filename date to todays date

Posted on 2015-02-22
2
53 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 49

Accepted Solution

by:
Rgonzo1971 earned 500 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Updates not working for MS Windows 7 12 166
vb6 connector to SQL Server 2 37
Set email body to html using vbscript 6 41
Formula problem with Excel attachment 6 27
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

803 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