Need to quit macro if datestamp isn't today

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
 
S

Steve Schapel

Mark,

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

- Steve Schapel, Microsoft Access MVP
 
M

Mark Penkower

It is ascii *.txt file - about 13 meg located on a network drive.

Thanks

Mark
 
S

Steve Schapel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top