Import then delete

D

daveks

Hi
Is it possible for Excel to import a text or csv file from a given
directory then delete it from the directory automatically while saving
the data in an .xls format? Hope this makes sence
Cheers
 
D

Dave Peterson

Record a macro when you open the text file.
Keep recording while you save that imported data as .xls.
And then look at the Kill statement in VBA's help.

Personally, I wouldn't delete the text file until I was absolutely positive that
the macro works perfectly--in fact, I'd leave the .txt files and delete them
using windows explorer at my convenience.
 
D

daveks

Dave
Thank you I'll try it
The point is a new text file is created (same name as one deleted by
another software package) at regular intervals, say 30 minutes. I need
to import the new data, preform some calculations based on the new and
previous data, then display the updated results I do not need any
history and the values are only important until the next period begins.

Simple example totalised widget production counter formula ... count at
10:30am - count at 10:00am =no. produced in last 30 minutes.
My reason for deleting file I so that the imported data will always
import to the same cells. I feel this would simplify formula ect.
Thanks again for help. I welcome any comments you have.
 
D

Dave Peterson

The only comment I have that it now makes more sense to me.

I just hate deleting files until I'm absolutely positive that I don't need
it--and you're at that point. In fact, if you ever find yourself thinking that
you should keep the file, you could just rename it. Check out the Name
statement in VBA's help.
 
D

daveks

Good advice .. renaming could well be useful if errors or bugs occurs.
It would allow tracability of past data. Thank you.
 

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