![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
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. |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Sorry,
CSV FILES bscull |
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
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 |
|
|
|
|
|
#4 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#5 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
|
Quote:
http://ca.geocities.com/b_davidso/We...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,
__________________
Barrie Davidson "You're only given a little spark of madness. You mustn't lose it." - Robin Williams |
|
|
|
|
|
|
#6 |
|
Guest
Posts: n/a
|
THANKS Everyonbe.
Barrie if i need a hand I will give you a call Thanks again. Bscull |
|
|
|
#7 |
|
Guest
Posts: n/a
|
THANKS Everyone.
Barrie if i need a hand I will give you a call Thanks again. Bscull |
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|