Need to quit macro if datestamp isn't today

  • Thread starter Thread starter Mark Penkower
  • Start date Start date
M

Mark Penkower

I need to have some code at the beginning of a macro that checks the
datestamp of a file. If the file wasn't created today, then I need to
put up a warning message box and quit the macro. After that check. I
need it to do a size check of the file - If the size is < defined size,
then I need to put up a message box and quit. If this can't be done,
then perhaps, I can have the code count the number of lines.

Thanks


Mark
 
Mark,

What is the nature of the file you are trying to check, and where is
it located?

- Steve Schapel, Microsoft Access MVP
 
Mark,

Put this in the Condition column for your first MsgBox macro action...
DateValue(FileDateTime("YourPath\YourFile.txt"))<>Date()
.... followed by a StopMacro action with ... ellipsis in the Condition.
Followed by your second MsgBox action, with Condition...
FileLen("YourPath\YourFile.txt")<x
.... where x is in bytes, e.g. 13000000
followed by another StopMacro action.

- Steve Schapel, Microsoft Access MVP
 
Back
Top