Batch importing CVS files

G

Guest

Guest
Hi,
I am looking to import lots of cvs files with different names, eg
0503200201.htd,
0503200202.htd,
0503200203.htd
and so no. After importing I want to delete this files. Is the possible in Excel OR Access.

Thanks

Bscull.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
In the VBE editor look up "Kill"

eg. Kill "c:CSVFiles*.csv"

will delete ALL files with csv extensions.
Pay to put in an error routine + confimation
JIC !!

Sub kills()
Dim OKToDelete As Integer
Dim sDir As String

sDir = "C:CSVFiles"

On Error GoTo FileErr
OKToDelete = MsgBox("Delete files in " & sDir, vbYesNo)
If OKToDelete = vbNo Then End
Kill sDir & "*.csv"
MsgBox "Done!"

FileErr:
MsgBox Err.Number & ":=" & Err.Description

End Sub


or something similar


HTH

Ivan
 
Upvote 0
Great, Thanks.

But how can I batch import lots of files with different names? There is only some parts of the file structure that I need to use.

Thanks

Bscull
 
Upvote 0
On 2002-03-06 03:05, Anonymous wrote:
Great, Thanks.

But how can I batch import lots of files with different names? There is only some parts of the file structure that I need to use.

Thanks

Bscull

Have a look at:

http://ca.geocities.com/b_davidso/Web_Page_Files/excel_vba.html

and look for the question "I have an Excel Template file (report.xlt) and text files (1.txt, 2.txt, 3.txt etc - 45 of this text files) in the same directory". The code for this could easily be modified to do what you're looking for. If you need any help just let me know.

Regards,
 
Upvote 0
THANKS Everyonbe.

Barrie if i need a hand I will give you a call

Thanks again.

Bscull
 
Upvote 0
THANKS Everyone.

Barrie if i need a hand I will give you a call

Thanks again.

Bscull
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,210
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top