View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Silencer116 Silencer116 is offline
external usenet poster
 
Posts: 8
Default Excel - Date comparision in VBA

Hey all,

I got this problem.
Every day i have a Macro creating a logfile, that contains the date of
today.

Like "Test" & Cstr(Date) & ".txt".

This works okay and stuff. But now i would like to have a logfile that
is 7 days or older; deleted.

That made me creating the following:

ExpiredDate = Date - 7
Expired = Date = ExpiredDate

this would result in:

Kill "H:/Test" & Cstr(Expired) & ".txt"

But this doesn´t seem to work.. Could someone help me?