Transfer Text Macro - How to stop macro if file isn't there

  • Thread starter Thread starter DBM
  • Start date Start date
D

DBM

Hello -

I have a macro that imports a text file, then runs multiple queries to
move/update tables. Unfortunately, the file name was named incorrectly the
last time I ran the macro therefore based upon my queries it blew out some
data. Fortunately, I have back-ups and could fix the error.

Trying to prevent this from occurring in the future, I am having trouble
writing a new macro line to stop the macro if the file for the Transfer Text
line doesn't exist.
Is this an easy fix?

Any guidance is much appreciated!
Best,
Darren
 
Darren,

Add a StopMacro action at the beginning of your macro, and use the
equivalent of the following as the Condition...
Len(Dir("C:\YourFolder\YourFile.txt"))=0
 
Back
Top