transfertext

R

r

Hello,

I have a very basic macro that:
1) renames an existing base table from "abc" to "abcYYYYMMDD" (where
YYYYMMDD is the current date).
2) uses transfertext to import data into a new table called "abc"

Problem is, if the data I'm trying to import doesn't exist, I no longer have
a base table available to do step 1 on the next run, and the whole thing
breaks down.

I'm not very good with code, so I'm looking for a simple solution. Either:

1) checking to see if the file is there, and quitting the macro if it's not,
or
2) if the transfertext fails, renaming the file BACK to "abc" (reversing
step 1).

Help?! I greatly appreciate any help!

Thanks.
 
K

Ken Snell [MVP]

It's easy to test if a file exists. You can use the Condition of a macro
step to test this:

Condition: Dir("PathToFile") = ""
Action: StopMacro
Comment: If this step is true, the file does not exist, so stop the
macro.
 

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