i got this:
Sub CSVToXls()
Dim myfile, mypath, workfile
Dim fso As Object
Dim folderName As String, FiletoDelete As String
Set fso = CreateObject("Scripting.FileSystemObject")
Application.ScreenUpdating = False
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Select A Folder!"
.ButtonName = "Confirm"
If .Show = -1 Then
folderName = .SelectedItems(1)
Else
MsgBox "You didn't select a folder.", vbExclamation, "Folder Not Selected!"
Exit Sub
End If
End With
If folderName = "" Then
MsgBox "You Didn't Select A Folder."
End If
Application.DisplayAlerts = False
myfile = ActiveWorkbook.Name
mypath = folderName & "\"
workfile = Dir(mypath & "*.CSV")
Do While workfile <> ""
Application.StatusBar = "Now working on " & workfile
Workbooks.Open Filename:=mypath & workfile
Columns("C").NumberFormat = "0000"
ActiveWorkbook.SaveAs Filename:=mypath & _
Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4), FileFormat:=xlNormal
ActiveWorkbook.Close
FiletoDelete = mypath & workfile
On Error Resume Next
Kill FiletoDelete
On Error GoTo 0
Windows(myfile).Activate
workfile = Dir()
Loop
End Sub
and it works :D thanks!!
but when i proceed to next step of my task copying the cell value to be used somewhere else,again copies the 3 digit number...can w e convert this to text
Bookmarks