Jump to content
Sign in to follow this  

CSV2XLS converter

Recommended Posts



Does anyone have a CV2XLS converter?


Share this post

Link to post
Share on other sites

this can be done in vba very quickly, so just do that,

Sub CSv_Converter()

    Dim fn As String
    Dim i As Long
    Dim CSVFiles() As String
    Dim myDir As String
    fn = Application.GetOpenFilename(filefilter:="CSV Files (*.csv),*.csv") 'launch file browser
    fn = Dir("*.csv") 'get csv files
    myDir = CurDir 'get current directory
    ReDim CSVFiles(0)
    If fn <> "False" Then
        CSVFiles(0) = fn
            fn = Dir
            If fn <> "" Then
                i = i + 1
                ReDim Preserve CSVFiles(i)
                CSVFiles(i) = fn 'store the csv filename found in the current directory
                Exit Do
            End If
        Loop While fn <> ""
    End If
    Application.ScreenUpdating = False
    'save each file to xls
    For i = 0 To UBound(CSVFiles)
        Workbooks.Open Filename:=myDir & "\" & CSVFiles(i)
        Application.DisplayAlerts = False 'prevents asking questions
        ActiveWorkbook.SaveAs Filename:=myDir & "\" & Replace(CSVFiles(i), ".csv", ".xls"), _
        FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
        ReadOnlyRecommended:=False, CreateBackup:=False
    Application.ScreenUpdating = True
End Sub

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this